/* ===== VISTA MOBILE DIPENDENTE: DESIGN MODERNO ===== */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
button, select, input { touch-action: manipulation; }

#emp-mobile-view { display: none; }
body.emp-mobile #emp-mobile-view { display: block; }
body.emp-mobile #page-calendario,
body.emp-mobile .emp-hide { display: none !important; }

.emp-nav-btn {
    width: 42px; height: 42px; flex: 0 0 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 14px; background: #eff6ff; color: #1d4ed8;
    font-size: 17px; font-weight: 800;
    border: 1px solid #dbeafe;
}
.emp-nav-btn:active { background: #dbeafe; }
.emp-nav-btn:disabled { opacity: .3; }

.emp-cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}
.emp-dow {
    text-align: center; font-size: 11px; font-weight: 800;
    color: #94a3b8; text-transform: uppercase;
    padding: 5px 0 8px; letter-spacing: .04em;
}
.emp-day {
    position: relative; width: 100%; min-width: 0;
    aspect-ratio: 1 / 1; min-height: 0;
    border-radius: 13px; border: 1px solid #e2e8f0;
    background: #fff; color: #334155;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px;
    font-size: clamp(13px, 4vw, 17px); font-weight: 750;
    line-height: 1; padding: 2px;
    user-select: none; -webkit-user-select: none;
    transition: transform .12s ease, box-shadow .12s ease;
}
.emp-day small {
    font-size: clamp(8px, 2.2vw, 10px);
    line-height: 1; font-weight: 800; margin: 0;
    letter-spacing: 0;
}
.emp-day.empty { border: 0; background: transparent; pointer-events: none; }
.emp-day.today { box-shadow: inset 0 0 0 2px #f97316; }
.emp-day.sel { outline: 3px solid #2563eb; outline-offset: 1px; z-index: 2; }
.emp-day:active { transform: scale(.96); }

#emp-fab {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 30; width: min(440px, calc(100vw - 28px));
    min-height: 54px; display: flex; align-items: center;
    justify-content: center; gap: 9px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; font-weight: 800; font-size: 16px;
    padding: 13px 22px; border-radius: 17px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .28);
    white-space: nowrap;
}
#emp-fab:active { transform: translateX(-50%) scale(.98); }
body.sheet-open #emp-fab { display: none; }

#sheet-richiesta-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .48);
    z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#sheet-richiesta-backdrop.open { opacity: 1; pointer-events: auto; }
#sheet-richiesta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    background: #fff; border-radius: 24px 24px 0 0;
    max-height: 91dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(105%); transition: transform .25s ease;
    box-shadow: 0 -10px 32px rgba(15, 23, 42, .18);
}
#sheet-richiesta.open { transform: none; }
#sheet-richiesta-body #box-richiesta-dipendente { border-top: 0 !important; padding-top: 0 !important; }
#sheet-richiesta-body #box-richiesta-dipendente > * + * { margin-top: .8rem; }
#sheet-richiesta-body #lbl-titolo-form { display: none; }
#sheet-richiesta-body .grid { gap: .75rem; }
#sheet-richiesta-body label { font-size: 13px; font-weight: 700; color: #475569; }
#sheet-richiesta-body input, #sheet-richiesta-body select { font-size: 16px; padding: .75rem .8rem; border: 1px solid #cbd5e1; border-radius: 12px; min-height: 48px; }
#sheet-richiesta-body #btn-invia-richiesta { padding: .95rem; font-size: 16px; min-height: 52px; border-radius: 13px; font-weight: 800; }
@media (max-width: 767px) {
    html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
    body.emp-mobile { background: #f1f5f9; }
    body.emp-mobile #view-app { width: 100% !important; max-width: 100% !important; min-width: 0 !important; margin: 0 !important; box-sizing: border-box !important; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(82px + env(safe-area-inset-bottom, 0px)) !important; overflow-x: hidden !important; }
    body.emp-mobile #view-app > header { display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: space-between !important; gap: 8px !important; width: 100% !important; margin: 0 0 12px !important; padding: 11px 13px !important; border: 1px solid #e2e8f0 !important; border-radius: 17px !important; box-shadow: 0 2px 8px rgba(15, 23, 42, .04) !important; box-sizing: border-box !important; }
    body.emp-mobile #view-app > header > div:first-child { min-width: 0; gap: 9px !important; }
    body.emp-mobile #view-app > header > div:first-child > div:first-child { font-size: 13px !important; padding: 7px 9px !important; border-radius: 9px !important; }
    body.emp-mobile #view-app > header h1 { font-size: 13px !important; }
    body.emp-mobile #view-app > header p { font-size: 10px !important; }
    body.emp-mobile #hdr-controls { width: auto !important; display: flex !important; flex: 0 0 auto !important; align-items: center !important; }
    body.emp-mobile #hdr-controls > :not(button[onclick="handleLogout()"]) { display: none !important; }
    body.emp-mobile #hdr-controls button[onclick="handleLogout()"] { display: inline-flex !important; align-items: center !important; justify-content: center !important; width: auto !important; min-height: 36px !important; padding: 8px 11px !important; border-radius: 10px !important; font-size: 12px !important; }
    body.emp-mobile #banner-mobile { display: none !important; }
    body.emp-mobile #emp-mobile-view { display: block !important; width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }
    body.emp-mobile #emp-mobile-view > div:first-child { background: #fff !important; border: 1px solid #e2e8f0 !important; border-radius: 18px !important; padding: 10px !important; margin-bottom: 12px !important; box-shadow: 0 2px 8px rgba(15, 23, 42, .035) !important; }
    body.emp-mobile #emp-titolo-mese { font-size: 16px !important; letter-spacing: .025em; }
    body.emp-mobile #emp-titolo-nome { font-size: 13px !important; color: #64748b !important; }
    body.emp-mobile #emp-mobile-view > div:first-child button:nth-child(2) > div:last-child { font-size: 9px !important; margin-top: 3px; }
    body.emp-mobile #emp-saldi { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 9px !important; width: 100% !important; margin: 0 0 12px !important; }
    body.emp-mobile #emp-saldi > div { min-width: 0 !important; min-height: 112px !important; display: flex !important; flex-direction: column !important; align-items: flex-start !important; justify-content: center !important; padding: 12px !important; border-radius: 17px !important; border: 1px solid #e2e8f0 !important; box-shadow: 0 2px 8px rgba(15, 23, 42, .035) !important; box-sizing: border-box !important; }
    body.emp-mobile #emp-saldi > div > div:first-child { font-size: 10px !important; letter-spacing: .045em; line-height: 1.3 !important; }
    body.emp-mobile #emp-saldi > div .text-3xl { font-size: 29px !important; line-height: 1 !important; }
    body.emp-mobile #emp-saldi > div .text-\[11px\] { font-size: 10px !important; line-height: 1.35 !important; }
    body.emp-mobile #emp-cal-wrap { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; padding: 13px 11px 12px !important; margin: 0 0 12px !important; border: 1px solid #e2e8f0 !important; border-radius: 19px !important; box-shadow: 0 3px 12px rgba(15, 23, 42, .04) !important; overflow: hidden !important; }
    body.emp-mobile #emp-cal-scroll { width: 100% !important; max-width: 100% !important; overflow: visible !important; padding: 0 !important; box-sizing: border-box !important; }
    body.emp-mobile #emp-cal { width: 100% !important; min-width: 0 !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 5px !important; }
    body.emp-mobile .emp-dow { font-size: 10px !important; padding: 4px 0 8px !important; }
    body.emp-mobile .emp-day { width: 100% !important; min-width: 0 !important; min-height: 0 !important; aspect-ratio: 1 / 1 !important; border-radius: 11px !important; font-size: 15px !important; }
    body.emp-mobile .emp-day small { font-size: 8px !important; }
    body.emp-mobile #emp-legenda { display: flex !important; flex-wrap: wrap !important; flex-direction: row !important; align-items: center !important; gap: 8px 12px !important; padding-top: 11px !important; margin-top: 12px !important; font-size: 10px !important; line-height: 1.35 !important; }
    body.emp-mobile #emp-legenda > span { display: inline-flex !important; align-items: center !important; gap: 5px !important; }
    body.emp-mobile #emp-legenda > span > span { width: 10px !important; height: 10px !important; flex: 0 0 10px; }
    body.emp-mobile #emp-dettaglio-giorno { margin-top: 11px !important; }
    body.emp-mobile #emp-dettaglio-giorno > div { border-radius: 13px !important; padding: 12px !important; }
    body.emp-mobile #emp-mobile-view > div.bg-white.rounded-2xl { width: 100% !important; box-sizing: border-box !important; padding: 14px !important; margin-bottom: 11px !important; border: 1px solid #e2e8f0 !important; border-radius: 17px !important; box-shadow: 0 2px 8px rgba(15, 23, 42, .03) !important; }
    body.emp-mobile #emp-mobile-view h3 { font-size: 11px !important; letter-spacing: .055em; color: #64748b !important; margin-bottom: 9px !important; }
    body.emp-mobile #emp-lista-assenze, body.emp-mobile #emp-lista-richieste, body.emp-mobile #emp-festivita { display: flex !important; flex-direction: column !important; gap: 8px !important; font-size: 13px !important; }
    body.emp-mobile #emp-fab { width: calc(100vw - 28px) !important; max-width: 440px !important; min-height: 55px !important; font-size: 16px !important; border-radius: 16px !important; }
    body.emp-mobile #sheet-richiesta { width: 100vw !important; max-width: 100vw !important; left: 0 !important; right: 0 !important; box-sizing: border-box !important; }
    body.emp-mobile #sheet-richiesta-body .grid { display: flex !important; flex-direction: column !important; gap: 11px !important; }
    body.emp-mobile #sheet-richiesta-body label { display: block !important; font-size: 13px !important; margin-bottom: 5px !important; }
    body.emp-mobile #sheet-richiesta-body input, body.emp-mobile #sheet-richiesta-body select, body.emp-mobile #sheet-richiesta-body button { width: 100% !important; min-height: 50px !important; box-sizing: border-box !important; font-size: 16px !important; }
}
.th-giorno { min-width: 26px; max-width: 26px; text-align: center; font-size: 0.65rem; padding: 4px 1px; }
.td-giorno { width: 26px; height: 32px; text-align: center; border: 1px solid #e5e7eb; font-size: 0.7rem; transition: all 0.1s; user-select: none; -webkit-user-select: none; }
.td-giorno.clickable { cursor: pointer; }
.td-giorno.clickable:hover { opacity: 0.85; filter: brightness(0.95); transform: scale(1.05); z-index: 5; }
.td-giorno.drag-selected { outline: 2px solid #2563eb; outline-offset: -2px; z-index: 6; background-color: #93c5fd !important; }
.weekend { background-color: #f3f4f6; color: #9ca3af; }
.mese-tabella-scroll { width: 100%; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.employee-month-card .mese-tabella-scroll table { width: max-content; min-width: 100%; table-layout: fixed; }
.employee-month-card .mese-tabella-scroll .th-giorno { min-width: 30px; width: 30px; max-width: 30px; }

@media (max-width: 767px) {
    .employee-month-card { padding: 0.5rem !important; overflow: hidden; }
    .employee-month-card .mese-tabella-scroll { margin-right: -0.5rem; padding-right: 0.5rem; scrollbar-width: thin; }
    .employee-month-card .mese-tabella-scroll .th-giorno { min-width: 34px; width: 34px; max-width: 34px; }
    .employee-month-card .mese-tabella-scroll td.td-giorno { min-width: 34px; width: 34px; height: 38px; font-size: 0.75rem; }
}

.festivo-parificato { background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold; border-color: #fca5a5 !important; }
.festivo-non-parificato { background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold; border-color: #86efac !important; }
.bloccato { background-color: #fee2e2; border: 1px solid #fca5a5; position: relative; color: #ef4444; font-weight: bold; }
.ferie-piena { background-color: #1d4ed8 !important; color: white !important; font-weight: bold; }
.ferie-mezza { background-color: #3b82f6 !important; color: white !important; font-weight: bold; }
.causale-M { background-color: #dc2626 !important; color: white !important; font-weight: bold; }
.causale-P { background-color: #d97706 !important; color: white !important; font-weight: bold; }
.causale-I { background-color: #7c3aed !important; color: white !important; font-weight: bold; }
.causale-C { background-color: #db2777 !important; color: white !important; font-weight: bold; }
.causale-FL { background-color: #0d9488 !important; color: white !important; font-weight: bold; }

.richiesta-attesa { background-color: #fef3c7 !important; color: #92400e !important; border: 1.5px dashed #f59e0b !important; font-weight: 700 !important; }
.richiesta-attesa-F { background-color: #dbeafe !important; color: #1e40af !important; border: 1.5px dashed #3b82f6 !important; font-weight: 700 !important; }

.td-giorno.sovrapposizione { outline: 2px solid #dc2626 !important; outline-offset: -2px; box-shadow: inset 0 0 6px rgba(220, 38, 38, 0.8); z-index: 4; }
.planner-bloccato { background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 3px, #cbd5e1 3px, #cbd5e1 6px) !important; color: #374151 !important; font-weight: 700; }
.planner-grid-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.planner-grid-table th, .planner-grid-table td { border: 1px solid #94a3b8; text-align: center; vertical-align: middle; padding: 2px 1px; word-break: break-word; line-height: 1.15; }
.planner-grid-table th.col-mese, .planner-grid-table td.col-mese { width: 78px; text-align: left; padding-left: 5px; font-weight: 800; }

@media print {
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .no-print { display: none !important; }
    body { background: white !important; color: black !important; padding: 0 !important; margin: 0 !important; font-size: 8pt !important; }
    #view-app { padding: 0 !important; max-width: 100% !important; }
    #page-calendario { display: block !important; grid-template-columns: none !important; }
    main { width: 100% !important; overflow: visible !important; border: none !important; padding: 0 !important; }
    #matrice-container { max-height: none !important; overflow: visible !important; space-y: 0 !important; }
    .shadow-sm, .shadow-2xs, .shadow-3xs { box-shadow: none !important; }
    .bg-white { background-color: white !important; }
    .sticky { position: static !important; }
    .mese-card { page-break-inside: avoid !important; break-inside: avoid !important; margin-bottom: 6px !important; padding: 2px !important; border: 1px solid #d1d5db !important; }
    table { width: 100% !important; border-collapse: collapse !important; margin-bottom: 2px !important; page-break-inside: avoid; }
    th, td { border: 1px solid #9ca3af !important; padding: 1px !important; font-size: 6.5pt !important; }
    .th-giorno { min-width: 18px !important; max-width: 18px !important; font-size: 6pt !important; padding: 1px 0 !important; }
    .td-giorno { width: 18px !important; height: 16px !important; font-size: 6.5pt !important; line-height: 16px !important; font-weight: bold !important; }
    .ferie-piena { background-color: #1e40af !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .ferie-mezza { background-color: #3b82f6 !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .causale-M { background-color: #991b1b !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .causale-P { background-color: #b45309 !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .causale-I { background-color: #5b21b6 !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .causale-C { background-color: #9d174d !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .causale-FL { background-color: #0f766e !important; color: #ffffff !important; border: 1.5px solid #000000 !important; }
    .bloccato { background-color: #fca5a5 !important; color: #7f1d1d !important; border: 1.5px solid #991b1b !important; }
    .festivo-parificato { background-color: #fee2e2 !important; color: #dc2626 !important; }
    .festivo-non-parificato { background-color: #dcfce7 !important; color: #166534 !important; }
    .weekend { background-color: #f3f4f6 !important; color: #9ca3af !important; }
    tr { page-break-inside: avoid; }
    h3 { font-size: 8.5pt !important; margin-bottom: 2px !important; margin-top: 2px !important; font-weight: bold !important; }
    body.printing-annual-planner #view-login, body.printing-annual-planner #view-app, body.printing-annual-planner #notifiche-toast-container { display: none !important; }
    body.printing-annual-planner #print-planner-annuale-sheet { display: block !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }
    body.printing-annual-planner.print-format-A4 .planner-grid-table th, body.printing-annual-planner.print-format-A4 .planner-grid-table td { font-size: 5.5pt !important; padding: 1.5px 1px !important; height: 22px !important; }
    body.printing-annual-planner.print-format-A4 .planner-grid-table th.col-mese, body.printing-annual-planner.print-format-A4 .planner-grid-table td.col-mese { width: 56px !important; font-size: 6pt !important; }
    body.printing-annual-planner.print-format-A3 .planner-grid-table th, body.printing-annual-planner.print-format-A3 .planner-grid-table td { font-size: 7pt !important; padding: 2.5px 1.5px !important; height: 30px !important; }
    body.printing-annual-planner.print-format-A3 .planner-grid-table th.col-mese, body.printing-annual-planner.print-format-A3 .planner-grid-table td.col-mese { width: 72px !important; font-size: 7.5pt !important; }
}
