/* 
 * style.css - Design System e Stile Premium per App Agenda AI
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Tema Scuro (Default) */
    --bg-main: #090b0e;
    --bg-surface: rgba(20, 24, 33, 0.6);
    --bg-sidebar: rgba(13, 16, 22, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Accenti Neon */
    --accent-primary: #8b5cf6; /* Viola */
    --accent-primary-glow: rgba(139, 92, 246, 0.35);
    --accent-secondary: #06b6d4; /* Ciano */
    --accent-secondary-glow: rgba(6, 182, 212, 0.35);
    --accent-success: #10b981; /* Smeraldo */
    --accent-success-glow: rgba(16, 185, 129, 0.2);
    --accent-warning: #f59e0b; /* Ambra */
    --accent-warning-glow: rgba(245, 158, 11, 0.2);
    --accent-danger: #ef4444; /* Rosso */
    
    /* Vetromorfismo */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-blur: blur(12px);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --card-radius: 16px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Variabili Sfondo Ambientale */
    --bg-glow-1: rgba(139, 92, 246, 0.06);
    --bg-glow-2: rgba(6, 182, 212, 0.05);
    --bg-pattern-color: rgba(255, 255, 255, 0.015);
    --bg-node-color: rgba(6, 182, 212, 0.1);
}

/* Tema Chiaro */
body.light-theme {
    --bg-main: #f4f6f9;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-sidebar: rgba(241, 243, 247, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --accent-primary: #6d28d9;
    --accent-primary-glow: rgba(109, 40, 217, 0.15);
    --accent-secondary: #0891b2;
    --accent-secondary-glow: rgba(8, 145, 178, 0.15);
    
    --glass-bg: rgba(255, 255, 255, 0.4);
    --shadow-premium: 0 8px 32px 0 rgba(31, 38, 135, 0.08);

    /* Variabili Sfondo Ambientale Light */
    --bg-glow-1: rgba(109, 40, 217, 0.04);
    --bg-glow-2: rgba(8, 145, 178, 0.03);
    --bg-pattern-color: rgba(0, 0, 0, 0.015);
    --bg-node-color: rgba(8, 145, 178, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbars */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
}
*::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.5s ease;
}

/* Layout dell'Applicazione */
.app-container {
    display: flex;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 100vh;
    position: relative;
}

/* Sidebar di Navigazione (Hamburger Drawer su tutti gli schermi) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)) 24px;
    justify-content: space-between;
    box-sizing: border-box;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    border-top: none;
    overflow-y: auto; /* Permette lo scorrimento verticale in caso di overflow degli elementi */
    
}

.sidebar.open {
    transform: translateX(0);
}

/* Barra Superiore Generale (Hamburger Mode) */
.mobile-top-bar {
    display: flex;
    height: calc(60px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    box-sizing: border-box;
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    padding-left: 16px;
    padding-right: 16px;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
}

.mobile-header-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding:  13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-header-btn i {
    width: 22px;
    height: 22px;
}

/* Sidebar Overlay Background */
.sidebar-overlay-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
    animation: fadeIn 0.2s ease-out forwards;
}

.sidebar-overlay-bg.active {
    display: block;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 15px var(--accent-primary-glow);
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: var(--glass-bg);
    border-color: var(--border-color);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--accent-primary-glow), transparent);
    border-left: 4px solid var(--accent-primary);
    box-shadow: var(--shadow-premium);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle, .backup-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-smooth);
    font-size: 14px;
}

.theme-toggle:hover, .backup-btn:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

/* Area di Contenuto Principale */
.main-content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: none; /* Aggiunto per evitare l'effetto rimbalzo */
    padding: 80px 40px 80px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    position: relative;
    box-sizing: border-box;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
    min-height: 100%;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Intestazione delle Pagine */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: normal;
    padding-bottom: 0.1em;
    overflow: visible !important;
}

.page-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: normal;
    padding-bottom: 0.1em;
    overflow: visible !important;
}

/* Dashboard Widget e Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.dashboard-details-layout {
    display: block;
    width: 100%;
}

.card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0.7;
}

.stat-card::before {
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--glass-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-secondary);
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-trend {
    margin-top: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-trend.positive { color: var(--accent-success); }
.stat-trend.neutral { color: var(--text-muted); }

/* Layout Calendario */
.calendar-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    height: calc(100vh - 160px);
}

.calendar-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--card-radius);
}

.calendar-nav-btn {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.calendar-nav-btn:hover {
    border-color: var(--border-hover);
    background: var(--border-color);
    transform: scale(1.1);
}

.calendar-current-month {
    font-size: 20px;
    font-weight: 700;
}

.calendar-grid-container {
    flex-grow: 1;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 8px;
    flex-grow: 1;
}

.calendar-day-cell {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.calendar-day-cell:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.calendar-day-cell.outside {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.calendar-day-cell.today {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.05));
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.calendar-day-cell.today .day-number {
    border: 1px solid var(--accent-primary);
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--accent-primary);
    align-self: flex-start;
}

.calendar-day-cell.selected {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(6, 182, 212, 0.03)) !important;
    border: 2px solid var(--accent-secondary) !important;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.35);
    transform: translateY(-2px);
}

.calendar-day-cell.selected .day-number {
    background: var(--accent-secondary) !important;
    color: #0b0f19 !important;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
    align-self: flex-start;
}

.calendar-day-cell.today.selected {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2)) !important;
    border: 2px solid var(--accent-secondary) !important;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.calendar-day-cell.today.selected .day-number {
    background: var(--accent-secondary) !important;
    color: #0b0f19 !important;
    border: 1px solid var(--accent-secondary) !important;
}

/* Evidenziazione in rosso per domeniche e festività nazionali */
.calendar-day-cell.sunday-holiday-cell:not(.selected) .day-number {
    color: var(--accent-danger) !important;
}

/* Sfondo delicatamente sfumato in rosso per domeniche e festività se non ci sono altri impegni */
.calendar-day-cell.sunday-holiday-cell:not(.outside):not(.today):not(.selected):not([class*="cal-"]) {
    background: rgba(239, 68, 68, 0.04) !important;
}
.calendar-day-cell.sunday-holiday-cell:not(.outside):not(.today):not(.selected):not([class*="cal-"]):hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

.day-number {
    font-size: 14px;
    font-weight: 700;
}

.day-events-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    overflow-y: hidden;
    max-height: 48px;
}

.day-event-dot {
    height: 4px;
    border-radius: 2px;
    background: var(--accent-primary);
    transition: var(--transition-smooth);
}

.day-event-dot.dot-lavoro { background: #3b82f6 !important; }
.day-event-dot.dot-personale { background: #ec4899 !important; }
.day-event-dot.dot-urgente { background: var(--accent-danger) !important; }
.day-event-dot.dot-ferie { background: #10b981 !important; }
.day-event-dot.dot-riposo { background: #a855f7 !important; }
.day-event-dot.dot-altre { background: #06b6d4 !important; }
.day-event-dot.dot-attesa { background: #f59e0b !important; }

.day-event-dot.has-pdf {
    box-shadow: 0 0 4px var(--accent-secondary-glow);
}

.day-badges {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
}

.badge-count {
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 8px;
    background: var(--border-color);
    color: var(--text-secondary);
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.badge-count i, .badge-count svg {
    width: 10px;
    height: 10px;
    display: inline-block;
}

.badge-count.pdf {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-secondary);
}

.badge-count.evt {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-primary);
}

/* Agenda Panel (Barra laterale Calendario) */
.agenda-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    overflow-y: auto;
}

.section-subtitle {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 420px);
    color: var(--text-primary);
}

.event-item {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 12px;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-item:hover {
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.event-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.event-item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.event-item-time {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 600;
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
}

.event-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.event-item-pdf {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--accent-secondary);
    background: rgba(6, 182, 212, 0.1);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    width: fit-content;
    transition: var(--transition-smooth);
}

.event-item-pdf:hover {
    background: rgba(6, 182, 212, 0.2);
}

.event-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

.action-btn-small {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.action-btn-small:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

.action-btn-small.delete:hover {
    color: var(--accent-danger);
}

/* Modali */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Supporto iPhone 16 Plus / iOS Safari */
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    width: 500px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: modalSlide 0.3s ease-out forwards;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    max-height: 90dvh;
}

@keyframes modalSlide {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex-grow: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2394a3b8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 40px !important; }
input, select, textarea {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition-smooth);
    min-width: 0;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary-glow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* File Upload Premium Style */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.file-upload-wrapper:hover {
    border-color: var(--accent-secondary);
    background: rgba(6, 182, 212, 0.03);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.file-upload-text i {
    font-size: 24px;
    color: var(--accent-secondary);
}

.file-selected-name {
    margin-top: 8px;
    font-size: 13px;
    color: var(--accent-success);
    font-weight: 500;
    display: none;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-main);
    flex-shrink: 0;
}

/* Sezioni Modulo Impegni Riprogettate */
.form-section {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.form-section:hover {
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.05);
}

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-primary);
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
    margin-bottom: 6px;
}

/* Icone all'interno dei campi di input */
.input-with-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0; /* Prevents overflow in flex/grid containers */
}

.input-with-icon-wrapper i,
.input-with-icon-wrapper svg {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.input-with-icon-wrapper input,
.input-with-icon-wrapper select,
.input-with-icon-wrapper textarea {
    padding-left: 42px !important;
    width: 100%; /* Ensure input/select occupies full wrapper width */
    min-width: 0;
}

/* Stile speciale per la card di riepilogo in alto */
.appt-preview-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(6, 182, 212, 0.04));
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
    margin-bottom: 4px;
    animation: fadeIn 0.3s ease-out;
}

/* Pulsanti per orari rapidi e turni */
.shift-main-btn, .shift-sub-btn {
    transition: all 0.2s ease;
}
.shift-main-btn:hover, .shift-sub-btn:hover {
    background: rgba(139, 92, 246, 0.1) !important;
    border-color: var(--accent-primary) !important;
    transform: translateY(-1px);
}
.shift-main-btn:active, .shift-sub-btn:active {
    transform: translateY(1px);
}
.shift-main-btn.active, .shift-sub-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), rgba(139, 92, 246, 0.6)) !important;
    border-color: var(--accent-primary) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* Pulsanti */
.btn {
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: normal;
    padding-bottom: 12px;
    overflow: visible !important;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 14px var(--accent-primary-glow);
}

.btn-primary:hover {
    background: #7c3aed;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--glass-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--border-color);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Sezione Rendicontazione */
.reporting-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.chart-container {
    height: 300px;
    position: relative;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:hover td {
    background: var(--glass-bg);
}

.status-pill {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.status-pill.paid {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.paid:hover {
    background: rgba(16, 185, 129, 0.25);
}

.status-pill.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.pending:hover {
    background: rgba(245, 158, 11, 0.25);
}

.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--card-radius);
    gap: 16px;
}

.filters-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-input-small {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
}

/* Chat Assistente AI */
.chat-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    height: calc(100vh - 160px);
}

.chat-info-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-container-main {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    overflow: hidden;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    animation: bubblePop 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes bubblePop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.chat-bubble.ai {
    align-self: flex-start;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--accent-primary);
    border-bottom-right-radius: 4px;
    color: white;
    box-shadow: 0 4px 12px var(--accent-primary-glow);
}

.chat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.chat-card-title {
    font-weight: bold;
    color: var(--accent-secondary);
}

.chat-card-btn {
    background: var(--accent-secondary);
    color: white;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    transition: var(--transition-smooth);
}

.chat-card-btn:hover {
    background: #0891b2;
}

.chat-input-area {
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.chat-input {
    flex-grow: 1;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition-smooth);
}

.chat-input:focus {
    border-color: var(--accent-primary);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px var(--accent-primary-glow);
}

.chat-send-btn:hover {
    background: #7c3aed;
    transform: translateY(-2px);
}

.suggested-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.suggested-chip {
    padding: 6px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.suggested-chip:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--border-color);
}

/* Notifiche Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-primary);
}

.toast.success::before { background: var(--accent-success); }
.toast.info::before { background: var(--accent-secondary); }
.toast.warning::before { background: var(--accent-warning); }

.toast.show {
    transform: translateX(0);
}

/* Print View per fatturazione/reportistica */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .sidebar, .filters-bar, .modal-overlay, .chat-layout, .nav-menu, .theme-toggle, .backup-btn {
        display: none !important;
    }
    .main-content {
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    .tab-panel {
        display: none !important;
    }
    .tab-panel#services-tab {
        display: block !important;
    }
    .card {
        border: 1px solid #ccc !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    .table-container {
        border: 1px solid #ccc !important;
        background: white !important;
    }
    th {
        background: #eee !important;
        color: black !important;
        border-bottom: 2px solid #ccc !important;
    }
    td {
        border-bottom: 1px solid #ccc !important;
        color: black !important;
    }
}

/* --- LOGICA SCHERMATA DI SICUREZZA --- */
.security-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Supporto iPhone 16 Plus / iOS Safari */
    background: radial-gradient(circle at center, #11151d, #06080b);
    backdrop-filter: blur(15px);
    z-index: 10000; /* Sopra a qualsiasi cosa */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    animation: overlayFadeIn 0.3s ease-out;
}

body.light-theme .security-overlay {
    background: radial-gradient(circle at center, #f4f6f9, #cbd5e1);
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.security-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.security-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 32px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Tastierino e Pallini PIN */
.pin-dots-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 32px 0;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pin-dot.filled {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    justify-items: center;
    max-width: 280px;
    margin: 0 auto;
    touch-action: none;
}

.pin-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
    outline: none;
    touch-action: none;
}

.pin-btn:hover {
    background: var(--border-color);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.pin-btn:active {
    background: var(--accent-primary-glow);
    border-color: var(--accent-primary);
}

.pin-btn.clear, .pin-btn.delete {
    border: none;
    background: transparent;
    color: var(--text-secondary);
}

.pin-btn.clear:hover, .pin-btn.delete:hover {
    color: var(--text-primary);
    background: transparent;
    transform: scale(1.1);
}

/* Animazione di errore PIN (shake) */
.pin-dots-container.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* --- STILI RESPONSIVE SPECIFICI PER SMARTPHONE (es. REDMI NOTE 13) --- */
@media (max-width: 768px) {
    /* Safe Area & Margini Globali */
    body {
        overflow: hidden !important;
        width: 100%;
        height: 100%;
        position: fixed;
        -webkit-text-size-adjust: 100%;
    }

    .app-container {
        flex-direction: column;
        height: 100% !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden !important;
        touch-action: pan-y;
    }

    /* Hamburger mode elements are defined globally */

    /* Mostra logo e pulsanti del footer nel drawer */
    .sidebar .brand-section {
        display: flex !important;
        margin-bottom: 12px !important;
    }

    .sidebar .sidebar-footer {
        display: flex !important;
        margin-top: auto;
        gap: 8px !important;
        padding-top: 12px !important;
    }

    .sidebar nav {
        display: block;
        width: 100%;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 6px;
        align-items: stretch;
        margin: 0;
    }

    .nav-menu li {
        width: 100%;
        display: block;
    }

    .nav-item {
        flex-direction: row;
        gap: 10px !important;
        padding: 10px 14px !important;
        font-size: 13.5px !important;
        border-radius: 10px !important;
        border-left: 4px solid transparent;
        border-top: none;
        width: 100%;
        height: auto;
        justify-content: flex-start;
        align-items: center;
        background: transparent !important;
    }

    .nav-item i {
        font-size: 18px !important;
    }

    .theme-toggle, .backup-btn {
        padding: 8px 10px !important;
        font-size: 12px !important;
        gap: 8px !important;
        border-radius: 8px !important;
    }

    .nav-item:hover {
        background: var(--glass-bg) !important;
    }

    .nav-item.active {
        color: var(--text-primary);
        border-left: 4px solid var(--accent-primary);
        border-top: none;
        background: linear-gradient(90deg, var(--accent-primary-glow), transparent) !important;
        box-shadow: var(--shadow-premium);
    }

    .main-content {
        padding-top: calc(76px + env(safe-area-inset-top)) !important;
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
        height: 100% !important;
        overflow-y: auto;
        overflow-x: hidden !important;
        overscroll-behavior-y: none !important; /* Evita pull-to-refresh e rimbalzo su mobile */
        gap: 20px;
        box-sizing: border-box;
        
        touch-action: pan-y;
        width: 100%;
        max-width: 100%;
    }


        margin-bottom: 8px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .page-header > div:first-child {
        width: 100%;
    }

    .page-header > div:last-child:not(:first-child),
    .page-header > button {
        display: flex;
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }

    .page-header button {
        flex: 1;
        justify-content: center;
        padding: 10px 10px 12px 10px !important;
        font-size: 13px !important;
        line-height: 1.4 !important;
    }

    .page-title {
        font-size: 26px;
        line-height: normal;
        padding-bottom: 0.1em;
        overflow: visible !important;
    }

    .page-subtitle {
        font-size: 13px;
        line-height: normal;
        padding-bottom: 0.1em;
        overflow: visible !important;
    }

    /* Griglia Statistiche Dashboard su 2 colonne per Redmi Note 13 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stats-grid .card {
        padding: 12px 8px !important;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-header {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
    }

    .stat-icon i {
        width: 16px;
        height: 16px;
    }

    /* Layout Dettagli Dashboard */
    .main-content > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important; /* Stack verticale */
        gap: 16px !important;
    }
    
    .dashboard-details-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    /* Calendario Responsivo */
    .calendar-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 16px;
    }

    .calendar-grid-container {
        min-height: 350px;
        padding: 10px;
    }

    .calendar-controls {
        padding: 10px 16px;
    }

    .calendar-current-month {
        font-size: 16px;
    }

    .calendar-weekdays {
        font-size: 11px;
        margin-bottom: 8px;
        gap: 4px !important;
    }

    .calendar-days {
        gap: 4px !important;
    }

    .calendar-day-cell {
        min-height: unset;
        aspect-ratio: 1; /* Celle quadrate perfette */
        padding: 4px 2px !important;
        justify-content: flex-start;
        position: relative;
    }

    .day-number {
        font-size: 11px !important;
        line-height: 1 !important;
    }

    .day-badges {
        display: flex;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 2px !important;
        position: absolute !important;
        bottom: 2px !important;
        right: 2px !important;
        left: unset !important;
        justify-content: flex-end !important;
    }

    .badge-count {
        font-size: 7px !important;
        padding: 0px 2px !important;
        border-radius: 4px !important;
        line-height: 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 1px !important;
    }

    .badge-count i, .badge-count svg {
        width: 7px !important;
        height: 7px !important;
    }

    .day-events-container {
        display: none; /* Nascondi i pallini sotto per non affollare la griglia su telefoni */
    }

    .agenda-panel {
        display: none !important;
    }

    .event-list {
        max-height: 250px;
    }

    /* Rendicontazione e Grafici */
    .reporting-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-container {
        height: 220px;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 14px;
    }

    .filters-inputs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }

    .filters-inputs .form-group {
        width: 100%;
    }

    .filters-inputs .form-group:first-child {
        grid-column: span 2;
    }

    .filters-bar button {
        width: 100% !important;
        justify-content: center;
        height: 42px;
    }

    /* Ottimizzazione tabelle e card per schermi piccoli (es. Redmi Note 13) */
    th, td {
        padding: 12px 8px !important;
        font-size: 13px !important;
    }
    
    td span.badge-count {
        font-size: 10px !important;
        padding: 2px 4px !important;
    }

    .card {
        padding: 16px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .table-container {
        border-radius: 8px !important;
        touch-action: auto !important;
    }

    /* Chat AI su Schermo Intero Mobile */
    .chat-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 180px);
        height: calc(100dvh - 180px); /* Supporto iPhone 16 Plus / iOS Safari */
        gap: 0;
    }

    #chat-info-panel-sidebar {
        display: none !important; /* Nasconde la sidebar con i suggerimenti per massimizzare la chat */
    }

    .chat-container-main {
        border-radius: 12px;
        height: 100%;
    }

    .chat-messages {
        padding: 16px;
        gap: 12px;
    }

    .chat-bubble {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .chat-input-area {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) 16px;
    }

    /* Modali Mobile - Bottom Sheet */
    .modal-overlay {
        align-items: flex-end; /* Posiziona la modale in basso */
    }

    .modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0 !important; /* Arrotonda solo in alto */
        border-bottom: none !important;
        max-height: 92vh !important;
        max-height: 92dvh !important;
        animation: bottomSheetSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.5) !important;
        padding-bottom: env(safe-area-inset-bottom) !important; /* Salva-spazio iOS bottom indicator */
    }

    /* Apertura immediata schede su mobile */
    .tab-panel {
        animation: fadeInMobile 0.15s ease-out forwards !important;
    }

    @keyframes fadeInMobile {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes bottomSheetSlide {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .modal-body {
        padding: 16px;
        gap: 12px;
    }

    .modal-footer {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr; /* Singola colonna nei moduli su mobile */
        gap: 12px;
    }

    /* Schermata di sicurezza Login / Setup PIN su telefoni Redmi */
    .security-card {
        max-width: 90% !important;
        padding: 24px 16px !important;
    }

    .pin-pad {
        gap: 12px;
        max-width: 250px;
    }

    .pin-btn {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
}

/* Stile per i giorni di ferie nel calendario */
.calendar-day-cell.holiday-cell {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04)) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.calendar-day-cell.holiday-cell:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.08)) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
}

.calendar-day-cell.holiday-cell.selected {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Colorazione premium per celle calendario in base alla categoria */
.calendar-day-cell.cal-ferie {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.04)) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}
.calendar-day-cell.cal-ferie:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.08)) !important;
    border-color: #10b981 !important;
}
.calendar-day-cell.cal-ferie .day-number {
    color: #10b981 !important;
}

.calendar-day-cell.cal-attesa {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.04)) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}
.calendar-day-cell.cal-attesa:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.08)) !important;
    border-color: #f59e0b !important;
}
.calendar-day-cell.cal-attesa .day-number {
    color: #f59e0b !important;
}

.calendar-day-cell.cal-urgente {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.04)) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}
.calendar-day-cell.cal-urgente:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.08)) !important;
    border-color: #ef4444 !important;
}
.calendar-day-cell.cal-urgente .day-number {
    color: #ef4444 !important;
}

.calendar-day-cell.cal-permesso {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.04)) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}
.calendar-day-cell.cal-permesso:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.08)) !important;
    border-color: #3b82f6 !important;
}
.calendar-day-cell.cal-permesso .day-number {
    color: #3b82f6 !important;
}

.calendar-day-cell.cal-riposo {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.04)) !important;
    border-color: rgba(168, 85, 247, 0.3) !important;
}
.calendar-day-cell.cal-riposo:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(168, 85, 247, 0.08)) !important;
    border-color: #a855f7 !important;
}
.calendar-day-cell.cal-riposo .day-number {
    color: #a855f7 !important;
}

.calendar-day-cell.cal-altre {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(6, 182, 212, 0.04)) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
}
.calendar-day-cell.cal-altre:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(6, 182, 212, 0.08)) !important;
    border-color: #06b6d4 !important;
}
.calendar-day-cell.cal-altre .day-number {
    color: #06b6d4 !important;
}

.calendar-day-cell.cal-lavoro {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.03)) !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
}
.calendar-day-cell.cal-lavoro:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.06)) !important;
    border-color: #3b82f6 !important;
}
.calendar-day-cell.cal-lavoro .day-number {
    color: #60a5fa !important;
}

.calendar-day-cell.cal-personale {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(236, 72, 153, 0.03)) !important;
    border-color: rgba(236, 72, 153, 0.25) !important;
}
.calendar-day-cell.cal-personale:hover {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.06)) !important;
    border-color: #ec4899 !important;
}
.calendar-day-cell.cal-personale .day-number {
    color: #f472b6 !important;
}

/* Classi per Colori Personalizzati Utente */
.calendar-day-cell.cal-custom-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.03)) !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
}
.calendar-day-cell.cal-custom-blue:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.06)) !important;
    border-color: #3b82f6 !important;
}
.calendar-day-cell.cal-custom-blue .day-number { color: #60a5fa !important; }

.calendar-day-cell.cal-custom-pink {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(236, 72, 153, 0.03)) !important;
    border-color: rgba(236, 72, 153, 0.25) !important;
}
.calendar-day-cell.cal-custom-pink:hover {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.06)) !important;
    border-color: #ec4899 !important;
}
.calendar-day-cell.cal-custom-pink .day-number { color: #f472b6 !important; }

.calendar-day-cell.cal-custom-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.03)) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
}
.calendar-day-cell.cal-custom-red:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.06)) !important;
    border-color: #ef4444 !important;
}
.calendar-day-cell.cal-custom-red .day-number { color: #f87171 !important; }

.calendar-day-cell.cal-custom-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.03)) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
}
.calendar-day-cell.cal-custom-green:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.06)) !important;
    border-color: #10b981 !important;
}
.calendar-day-cell.cal-custom-green .day-number { color: #34d399 !important; }

.calendar-day-cell.cal-custom-purple {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(168, 85, 247, 0.03)) !important;
    border-color: rgba(168, 85, 247, 0.25) !important;
}
.calendar-day-cell.cal-custom-purple:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.06)) !important;
    border-color: #a855f7 !important;
}
.calendar-day-cell.cal-custom-purple .day-number { color: #c084fc !important; }

.calendar-day-cell.cal-custom-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(6, 182, 212, 0.03)) !important;
    border-color: rgba(6, 182, 212, 0.25) !important;
}
.calendar-day-cell.cal-custom-cyan:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.06)) !important;
    border-color: #06b6d4 !important;
}
.calendar-day-cell.cal-custom-cyan .day-number { color: #22d3ee !important; }

.calendar-day-cell.cal-custom-yellow {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.03)) !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
}
.calendar-day-cell.cal-custom-yellow:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.06)) !important;
    border-color: #f59e0b !important;
}
.calendar-day-cell.cal-custom-yellow .day-number { color: #fbbf24 !important; }

/* Stili per pallini colorati personalizzati */
.day-event-dot.dot-custom-blue { background: #3b82f6 !important; }
.day-event-dot.dot-custom-pink { background: #ec4899 !important; }
.day-event-dot.dot-custom-red { background: #ef4444 !important; }
.day-event-dot.dot-custom-green { background: #10b981 !important; }
.day-event-dot.dot-custom-purple { background: #a855f7 !important; }
.day-event-dot.dot-custom-cyan { background: #06b6d4 !important; }
.day-event-dot.dot-custom-yellow { background: #f59e0b !important; }

/* Color chips selector animation */
.color-chip {
    transition: var(--transition-smooth);
}
.color-chip:hover {
    transform: scale(1.15);
}

/* Contenitore Storico per garantire layout responsive senza overflow */
.contenitore-storico {
  width: 100%; /* Occupa tutto lo spazio disponibile */
  max-width: 100%; /* Non superare la larghezza dello schermo */
  padding: 0 15px; /* Crea un piccolo margine ai lati */
  box-sizing: border-box; /* Assicura che il padding sia incluso nella larghezza */
}

/* Evita il doppio padding quando il contenitore-storico è nidificato in una card */
.card .contenitore-storico {
    padding: 0 !important;
}

/* Ottimizzazione mobile specifica per la tabella dei Saldi Ferie */
@media (max-width: 768px) {
    #holiday-balances-table {
        table-layout: fixed !important;
        width: 100% !important;
    }

    #holiday-balances-table th, 
    #holiday-balances-table td {
        padding: 6px 2px !important;
        font-size: 11px !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Ottimizzazioni specifiche per iOS */
    .platform-ios #holiday-balances-table th:nth-child(1),
    .platform-ios #holiday-balances-table td:nth-child(1) {
        width: 50% !important;
    }
    .platform-ios #holiday-balances-table th:nth-child(2),
    .platform-ios #holiday-balances-table td:nth-child(2) {
        width: 18% !important;
        text-align: center !important;
    }
    .platform-ios #holiday-balances-table th:nth-child(3),
    .platform-ios #holiday-balances-table td:nth-child(3) {
        width: 16% !important;
        text-align: center !important;
    }
    .platform-ios #holiday-balances-table th:nth-child(4),
    .platform-ios #holiday-balances-table td:nth-child(4) {
        width: 16% !important;
        text-align: center !important;
    }
    .platform-ios #holiday-balances-table td button {
        width: 18px !important;
        height: 18px !important;
        padding: 0 !important;
        min-width: 18px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    .platform-ios #holiday-balances-table td svg {
        width: 11px !important;
        height: 11px !important;
    }

    /* Stili di base e per Android */
    :not(.platform-ios) #holiday-balances-table th:nth-child(1),
    :not(.platform-ios) #holiday-balances-table td:nth-child(1) {
        width: 42% !important;
    }
    :not(.platform-ios) #holiday-balances-table th:nth-child(2),
    :not(.platform-ios) #holiday-balances-table td:nth-child(2) {
        width: 24% !important;
    }
    :not(.platform-ios) #holiday-balances-table th:nth-child(3),
    :not(.platform-ios) #holiday-balances-table td:nth-child(3) {
        width: 17% !important;
        text-align: center !important;
    }
    :not(.platform-ios) #holiday-balances-table th:nth-child(4),
    :not(.platform-ios) #holiday-balances-table td:nth-child(4) {
        width: 17% !important;
        text-align: center !important;
    }
    
    #holiday-balances-table th .desktop-text {
        display: none !important;
    }
    #holiday-balances-table th .mobile-text {
        display: inline !important;
    }
    #holiday-balances-table td div {
        gap: 2px !important;
    }
    :not(.platform-ios) #holiday-balances-table td .action-btn-small {
        padding: 2px !important;
    }
}

/* --- STILI SFONDO AMBIENTALE PREMIUM --- */
.app-bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
    background-color: var(--bg-main);
    will-change: transform;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.7;
    will-change: transform, opacity;
}

.bg-glow-purple {
    top: -10%;
    right: -10%;
    width: 550px;
    height: 550px;
    background: var(--bg-glow-1);
    animation: glowPulsePurple 15s infinite alternate ease-in-out;
}

.bg-glow-cyan {
    bottom: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: var(--bg-glow-2);
    animation: glowPulseCyan 12s infinite alternate ease-in-out;
}

.bg-grid-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(var(--bg-pattern-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-pattern-color) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.65;
    will-change: opacity;
}

.bg-decoration {
    position: fixed;
    pointer-events: none;
    z-index: -1;
    opacity: 0.35;
    transition: opacity 0.3s ease;
}

.left-deco {
    left: 1%;
    bottom: 5%;
    width: 300px;
    height: 400px;
}

.right-deco {
    right: 1%;
    top: 10%;
    width: 350px;
    height: 500px;
}

/* Colore delle linee e delle sagome icone negli SVG */
.bg-decoration stroke {
    stroke: var(--bg-pattern-color);
}
.bg-decoration circle[fill="none"] {
    stroke: var(--bg-pattern-color);
}

/* Animazione di pulsazione dei nodi AI */
.bg-pulse-node {
    animation: bgPulseNode 3s infinite ease-in-out;
    transform-origin: center;
}

@keyframes bgPulseNode {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
        filter: drop-shadow(0 0 2px var(--accent-primary-glow));
    }
    50% {
        transform: scale(1.4);
        opacity: 1;
        filter: drop-shadow(0 0 6px var(--accent-primary-glow));
    }
}

@keyframes glowPulsePurple {
    0% { transform: translate(0, 0) scale(1); opacity: 0.6; }
    100% { transform: translate(-40px, 30px) scale(1.1); opacity: 0.85; }
}

@keyframes glowPulseCyan {
    0% { transform: translate(0, 0) scale(1); opacity: 0.5; }
    100% { transform: translate(30px, -40px) scale(1.15); opacity: 0.8; }
}

/* Riduzione opacità su mobile per evitare qualsiasi interferenza */
@media (max-width: 768px) {
    .bg-decoration {
        opacity: 0.12 !important;
    }
    .left-deco {
        left: -5%;
        bottom: 2%;
        transform: scale(0.8);
    }
    .right-deco {
        right: -5%;
        top: 8%;
        transform: scale(0.8);
    }
    .bg-glow {
        filter: blur(80px);
    }
}

/* Dashboard Action Cards (Riepilogo e Santo del Giorno) */
.dashboard-action-card {
    cursor: pointer;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: all 0.2s ease;
}

.premium-action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 16px;
    margin-top: 16px;
    cursor: pointer;
    min-height: 80px;
    height: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dashboard-action-card .action-card-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex-grow: 1;
}

.dashboard-action-card .action-card-icon-wrapper {
    border-radius: 10px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-action-card .action-card-svg-icon,
.dashboard-action-card .action-card-icon-wrapper svg {
    width: 28px;
    height: 28px;
}

.dashboard-action-card .action-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex-grow: 1;
}

.dashboard-action-card .action-card-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashboard-action-card .action-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-action-card .action-card-chevron {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dashboard-action-card .action-card-chevron-svg,
.dashboard-action-card .action-card-chevron svg {
    width: 16px;
    height: 16px;
}

/* Adattamento Responsive Action Cards su Mobile */
@media (max-width: 768px) {
    .dashboard-action-card {
        padding: 16px 14px !important;
        gap: 12px !important;
        margin-top: 16px !important;
    }
    .dashboard-action-card .action-card-left {
        gap: 12px !important;
    }
    .dashboard-action-card .action-card-icon-wrapper {
        width: 50px !important;
        height: 50px !important;
        border-radius: 10px !important;
    }
    .dashboard-action-card .action-card-svg-icon,
    .dashboard-action-card .action-card-icon-wrapper svg {
        width: 22px !important;
        height: 22px !important;
    }
    .dashboard-action-card .action-card-icon-wrapper #saint-card-day-num {
        font-size: 20px !important;
        line-height: 1.1 !important;
    }
    .dashboard-action-card .action-card-icon-wrapper #saint-card-month-year {
        font-size: 8px !important;
        margin-top: 1px !important;
        line-height: 1 !important;
    }
    .dashboard-action-card .action-card-badge {
        font-size: 10px !important;
        margin-bottom: 2px !important;
    }
    .dashboard-action-card .action-card-title {
        font-size: 14px !important;
        line-height: 1.3 !important;
    }
    .dashboard-action-card .action-card-chevron {
        width: 30px !important;
        height: 30px !important;
    }
    .dashboard-action-card .action-card-chevron-svg,
    .dashboard-action-card .action-card-chevron svg {
        width: 14px !important;
        height: 14px !important;
    }
}

/* Stile per il pulsante Esci nella barra di navigazione */
.nav-item.logout-nav-item {
    color: var(--accent-danger) !important;
    font-weight: 600;
}

.nav-item.logout-nav-item i {
    color: var(--accent-danger) !important;
}

.nav-item.logout-nav-item:hover {
    color: #ff4d4d !important;
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

/* ==========================================================================
   OTTIMIZZAZIONI COMPLETE PER DISPOSITIVI APPLE (iOS Safari & PWA Standalone)
   ========================================================================== */

/* Ottimizzazione del tocco ed eliminazione del flash grigio per iOS Safari */
.btn, .nav-item, .calendar-day-cell, .pin-btn, .action-card, .theme-toggle, .backup-btn, .modal-close, .chat-send-btn, [onclick] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Stili per la Guida all'Installazione iOS */
.ios-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px) saturate(190%);
    -webkit-backdrop-filter: blur(20px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 18px;
    z-index: 99999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
    animation: iosPromptSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes iosPromptSlideUp {
    from {
        transform: translateY(150%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes iosPromptSlideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(150%);
        opacity: 0;
    }
}

.ios-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ios-prompt-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-secondary);
    letter-spacing: 0.5px;
}

.ios-prompt-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.ios-prompt-close:hover {
    color: var(--text-primary);
}

.ios-prompt-body ol {
    margin: 0;
    padding-left: 20px;
}

@media (min-width: 480px) {
    .ios-install-prompt {
        left: auto;
        right: 20px;
        width: 360px;
    }
}

/* ==========================================================================
   CARD PREMIUM: RIEPILOGO TURNI SETTIMANALI & SANTO DEL GIORNO
   ========================================================================== */



/* Specifico per Riepilogo Turni Settimanali (Blu elettrico e azzurro) */
.premium-action-card.weekly-summary-card {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), 
                inset 0 1px 1px rgba(255, 255, 255, 0.05),
                0 0 15px rgba(59, 130, 246, 0.08);
}

.premium-action-card.weekly-summary-card:hover {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5), 
                inset 0 1px 1px rgba(255, 255, 255, 0.08),
                0 0 25px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.premium-action-card.weekly-summary-card:active {
    transform: scale(0.97) translateY(0);
}

/* Specifico per Santo del Giorno (Viola e blu notte) */
.premium-action-card.saint-card {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), 
                inset 0 1px 1px rgba(255, 255, 255, 0.05),
                0 0 15px rgba(139, 92, 246, 0.08);
}

.premium-action-card.saint-card:hover {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5), 
                inset 0 1px 1px rgba(255, 255, 255, 0.08),
                0 0 25px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.premium-action-card.saint-card:active {
    transform: scale(0.97) translateY(0);
}

/* Layout Interno */
.premium-action-card .card-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex-grow: 1;
}

/* Riquadro Icona a sinistra */
.premium-action-card .icon-container {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
}

/* Icona per Turni Settimanali */
.premium-action-card.weekly-summary-card .icon-container {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    color: #ffffff;
}

/* Icona per Santo del Giorno */
.premium-action-card.saint-card .icon-container {
    background: linear-gradient(135deg, #7c3aed, #1e1b4b);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
    color: #ffffff;
    flex-direction: column;
    gap: 2px;
}

.premium-action-card.saint-card .icon-container span#saint-card-day-num {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.premium-action-card.saint-card .icon-container span#saint-card-month-year {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 1px;
}

.premium-action-card .icon-container svg {
    width: 26px;
    height: 26px;
}

/* Centro: testi */
.premium-action-card .card-center {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex-grow: 1;
}

.premium-action-card .card-subtitle {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.premium-action-card.weekly-summary-card .card-subtitle {
    color: #60a5fa;
}

.premium-action-card.saint-card .card-subtitle {
    color: #a78bfa;
}

.premium-action-card .card-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.3px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Destra: pulsante circolare con freccia */
.premium-action-card .action-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-action-card.weekly-summary-card .action-button {
    border-color: rgba(96, 165, 250, 0.3);
}

.premium-action-card.saint-card .action-button {
    border-color: rgba(167, 139, 250, 0.3);
}

.premium-action-card:hover .action-button {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.premium-action-card:active .action-button {
    transform: scale(0.92);
}

.premium-action-card .action-button svg {
    width: 16px;
    height: 16px;
}

/* Adattamento Responsive su Mobile */
@media (max-width: 768px) {
    .premium-action-card {
        min-height: 80px;
        height: auto;
        padding: 10px 14px;
        border-radius: 14px;
        margin-top: 12px;
    }
    
    .premium-action-card .card-left {
        gap: 12px;
    }
    
    .premium-action-card .icon-container {
        width: 46px;
        height: 46px;
        border-radius: 10px;
    }
    
    .premium-action-card .icon-container svg {
        width: 20px;
        height: 20px;
    }
    
    .premium-action-card.saint-card .icon-container span#saint-card-day-num {
        font-size: 16px;
    }
    
    .premium-action-card.saint-card .icon-container span#saint-card-month-year {
        font-size: 7px;
    }
    
    .premium-action-card .card-title {
        font-size: 14px;
    }
    
    .premium-action-card .card-subtitle {
        font-size: 9px;
        letter-spacing: 0.8px;
    }
    
    .premium-action-card .action-button {
        width: 32px;
        height: 32px;
    }
    
    .premium-action-card .action-button svg {
        width: 14px;
        height: 14px;
    }
}




.blinking-text { animation: blink 1s linear infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* Override Bottom Sheet behavior for specific Holidays modals */
@media (max-width: 768px) {
    #holiday-balances-modal,
    #monthly-holidays-report-modal,
    #recuperi-monitor-modal {
        align-items: center !important;
        padding: 20px;
    }
    
    #holiday-balances-modal .modal,
    #monthly-holidays-report-modal .modal,
    #recuperi-monitor-modal .modal {
        width: 100% !important;
        max-width: 500px !important;
        border-radius: 20px !important;
        border-bottom: 1px solid var(--border-color) !important;
        max-height: 85vh !important;
        margin: auto;
        animation: modalSlide 0.3s ease-out forwards !important;
        padding-bottom: 0 !important;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important;
    }
}


/* Posizionamento forzato in ALTO per le modali report assenze */
#monthly-holidays-report-modal, #recuperi-monitor-modal {
    align-items: flex-start !important;
    padding-top: 80px !important;
}
#monthly-holidays-report-modal .modal, #recuperi-monitor-modal .modal {
    margin-top: 0 !important;
    border-radius: 20px !important;
    border: 1px solid var(--border-color) !important;
    animation: modalSlideDown 0.3s ease-out forwards !important;
}
@keyframes modalSlideDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.action-btn-small.dashboard-edit-btn {
    padding: 4px !important;
}

/* Ottimizzazione tabelle e liste su mobile (Ferie e Congedi) */
@media (max-width: 768px) {
    /* Rimuovi l'overflow orizzontale */
    .table-container,
    .contenitore-storico,
    #holiday-balances-modal .modal-body,
    #monthly-report-list {
        overflow-x: hidden !important;
        padding: 4px !important;
    }
    
    table, #holiday-balances-table {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    /* Nascondi gli header della tabella */
    #holiday-balances-table thead {
        display: none !important;
    }

    /* La riga diventa un contenitore verticale (Card) */
    #holiday-balances-table tbody,
    #holiday-balances-table tr, 
    #holiday-balances-table td { 
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Stile della card per renderla carina */
    #holiday-balances-table tr {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(79, 70, 229, 0.2);
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 12px;
    }
    
    /* Etichette data-label per td se necessario, altrimenti solo stile testo */
    #holiday-balances-table td {
        padding: 6px 0 !important;
        font-size: 13px !important;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        align-items: flex-start !important;
        text-align: left !important;
    }

    #holiday-balances-table td:first-child {
        font-weight: bold;
        color: var(--accent-primary);
        font-size: 14px !important;
    }
    
    /* La colonna Azioni si sposta in fondo alla card, centrata o specchiata */
    #holiday-balances-table td:last-child {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: none;
        flex-direction: row !important; /* I pulsanti interni restano affiancati */
        justify-content: flex-end !important;
        gap: 8px;
    }
    
    .stat-card, .monthly-report-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }
    
    .monthly-report-item > div {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-bottom: 4px;
    }
}

/* Ottimizzazione tabelle Fogli di Viaggio su mobile (Card Verticali) */
@media (max-width: 768px) {
    /* Rimuovi l'overflow orizzontale dal contenitore */
    #travelsheets-tab .table-container {
        overflow-x: hidden !important;
        padding: 4px !important;
    }
    
    #travelsheets-table {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    /* Nascondi gli header della tabella */
    #travelsheets-table thead {
        display: none !important;
    }

    /* La riga diventa un contenitore verticale (Card) */
    #travelsheets-table tbody,
    #travelsheets-table tr, 
    #travelsheets-table td { 
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Stile della card per renderla carina */
    #travelsheets-table tr {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(79, 70, 229, 0.2);
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 12px;
    }
    
    #travelsheets-table td {
        padding: 6px 0 !important;
        font-size: 13px !important;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        align-items: flex-start !important;
        text-align: left !important;
    }

    #travelsheets-table td:first-child {
        font-weight: bold;
        color: var(--accent-primary);
        font-size: 14px !important;
    }
    
    /* La colonna Azioni si sposta in fondo alla card, centrata o specchiata */
    #travelsheets-table td:last-child {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: none;
        flex-direction: row !important; /* I pulsanti interni restano affiancati */
        justify-content: flex-end !important;
        gap: 8px;
    }
}


/* Global Date Selectors */
.global-date-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 32px;
}
.global-date-select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
.global-date-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
.global-date-select option {
    background-color: var(--surface-color);
    color: var(--text-primary);
}


.custom-time-select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 14px;
    appearance: none;
    outline: none;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
}
.custom-time-select:focus {
    border-color: var(--accent-primary);
}
/* Stile personalizzato barra di scorrimento (Scrollbar) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mobile adjustments for Travel Sheet */
.fasce-operative-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 768px) {
    .fasce-operative-grid {
        grid-template-columns: 1fr !important;
    }
}
