/* LE MIE ORE · Build 53 TEST
   Calendario fisso su mobile: lo scrolling resta nei pannelli secondari e nell'editor.
   I 6 pulsanti rapidi, i saldi e tutti i collegamenti rimangono disponibili. */
@media screen and (max-width:760px){
 html:has(body.v21-calendar-active){
  height:100%;max-height:100%;overflow:hidden!important;
  overscroll-behavior:none;
 }
 body.v21-calendar-active{
  height:100dvh!important;max-height:100dvh!important;
  overflow:hidden!important;overscroll-behavior:none;
 }
 body.v21-calendar-active>main,
 body.v21-calendar-active #appShell{height:100dvh!important;max-height:100dvh!important;overflow:hidden!important}
 body.v21-calendar-active #calendarPage{
  box-sizing:border-box!important;height:var(--v53-calendar-height,calc(100dvh - 54px))!important;
  max-height:var(--v53-calendar-height,calc(100dvh - 54px))!important;min-height:0!important;
  overflow:clip!important;overscroll-behavior:none!important;
  padding:0!important;-webkit-overflow-scrolling:auto!important;
 }
 body.v21-calendar-active #calendarPage>.card:first-child{
  padding-bottom:0!important;margin-bottom:0!important;
 }
 /* Leave the original modal/dialog scrolling intact. */
 body.v21-calendar-active #calendarPage .v52-content{overflow-y:auto!important;touch-action:pan-y!important}
 body.v21-calendar-active #calendarPage #dayEditorCard:not([hidden]){
  overflow-y:auto!important;touch-action:pan-y!important;
 }
 body.v21-calendar-active #calendarPage .v21-add-day{
  bottom:calc(12px + env(safe-area-inset-bottom,0px))!important;
 }
}
/* Smaller, less tall phones: shrink empty padding, not controls or functionality. */
@media screen and (max-width:760px) and (max-height:750px){
 body.v21-calendar-active #calendarPage>.card:first-child>.bar{margin-bottom:3px!important}
 body.v21-calendar-active #calendarPage .calendar-preview.v30-day-preview{
  margin:2px 0!important;padding:4px 6px!important;
 }
 body.v21-calendar-active #calendarPage .calendar-preview-title{
  font-size:12px!important;line-height:1.18!important;margin:0 0 2px!important;
 }
 body.v21-calendar-active #calendarPage .v30-day-preview p{font-size:10px!important;line-height:1.2!important;margin:0!important}
 body.v21-calendar-active #calendarPage .v30-day-preview .preview-actions button{
  min-height:29px!important;max-height:33px!important;padding:3px!important;
 }
 body.v21-calendar-active #calendarPage .calendar{gap:2px!important;margin-top:1px!important}
 body.v21-calendar-active #calendarPage .wd{padding:0 0 2px!important}
 body.v21-calendar-active #calendarPage .day{
  height:clamp(29px,calc((100dvh - 470px)/6),39px)!important;
  min-height:clamp(29px,calc((100dvh - 470px)/6),39px)!important;
  max-height:clamp(29px,calc((100dvh - 470px)/6),39px)!important;
  padding:1px 0!important;
 }
 body.v21-calendar-active #calendarPage .day::before{height:7px!important;min-height:7px!important;line-height:7px!important;font-size:7px!important}
 body.v21-calendar-active #calendarPage .day .v30-day-number{font-size:11px!important;line-height:1!important}
 body.v21-calendar-active #calendarPage .day small{font-size:7.6px!important;line-height:1!important}
 body.v21-calendar-active #calendarPage .day .day-hours{font-size:7.6px!important;line-height:1!important}
 body.v21-calendar-active #calendarPage .v51-calendar-overview{
  grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr)!important;
  gap:4px!important;margin:3px 0!important;
 }
 body.v21-calendar-active #calendarPage #mrOvertimeBalance{
  min-height:43px!important;padding:5px 6px!important;font-size:10px!important;
  line-height:1.15!important;gap:5px!important;word-break:break-word;
 }
 body.v21-calendar-active #calendarPage .v29-month-toggle{
  min-height:43px!important;padding:4px 5px!important;font-size:10px!important;
 }
 body.v21-calendar-active #calendarPage .v29-month-toggle strong{font-size:10.5px!important}
 body.v21-calendar-active #calendarPage .v22-smart-tools.v29-one-row-actions{margin:2px 0!important}
 body.v21-calendar-active #calendarPage .v22-smart-tools.v29-one-row-actions button{
  min-height:34px!important;padding:3px 2px!important;
 }
 body.v21-calendar-active #calendarPage .v26-quick-heading{
  margin:2px 0 1px!important;min-height:30px!important;
 }
 body.v21-calendar-active #calendarPage #v52OtherJobsOpen{
  min-height:30px!important;padding:3px 8px!important;
 }
 body.v21-calendar-active #calendarPage .v26-quick-grid>.v26-quick-button{
  min-height:42px!important;max-height:43px!important;
 }
 body.v21-calendar-active #calendarPage .legend{margin:2px 0 0!important;gap:4px 7px!important}
 body.v21-calendar-active #calendarPage .legend span{font-size:9.5px!important}
}
@media print{
 html:has(body.v21-calendar-active){height:auto!important;overflow:visible!important}
 body.v21-calendar-active,body.v21-calendar-active #calendarPage{
  overflow:visible!important;height:auto!important;max-height:none!important;
 }
}

/* Fixed-height compact preview when the selected date has many records. */
@media screen and (max-width:760px) and (max-height:750px){
 body.v21-calendar-active #calendarPage .calendar-preview.v30-day-preview{
  display:flex!important;flex-direction:column!important;
  max-height:clamp(78px,calc(100dvh - 580px),110px)!important;
  overflow:hidden!important;
 }
 body.v21-calendar-active #calendarPage .v53-preview-body{
  flex:1 1 auto;min-height:0;overflow-y:auto!important;overflow-x:hidden!important;
  overscroll-behavior:contain;touch-action:pan-y;
  scrollbar-width:none;
 }
 body.v21-calendar-active #calendarPage .v53-preview-body::-webkit-scrollbar{display:none}
 body.v21-calendar-active #calendarPage .calendar-preview-title,
 body.v21-calendar-active #calendarPage .preview-actions.v29-day-actions{
  flex:none;margin-top:0!important;
 }
 body.v21-calendar-active #calendarPage #v29DayStatus:empty{display:none}
}
/* The smallest phone sizes still show quick buttons and legend without scrolling. */
@media screen and (max-width:760px) and (max-height:620px){
 body.v21-calendar-active #calendarPage .day{height:26px!important;min-height:26px!important;max-height:26px!important}
 body.v21-calendar-active #calendarPage .v26-quick-heading{min-height:27px!important}
 body.v21-calendar-active #calendarPage #v52OtherJobsOpen{min-height:27px!important}
 body.v21-calendar-active #calendarPage .legend{gap:2px 5px!important}
}

/* Holding a calendar cell must never highlight its number, text or neighbors. */
#calendarPage #calendar button.day,
#calendarPage #calendar button.day *{
  -webkit-user-select:none!important;user-select:none!important;
  -webkit-touch-callout:none!important;
}
#calendarPage #calendar button.day{touch-action:manipulation;}


/* Build 54 TEST — no accidental text selection/callouts throughout the PWA.
   Editing text, notes, passwords and values INSIDE real fields remains possible. */
body, body *, body *::before, body *::after{
  -webkit-user-select:none!important;
  user-select:none!important;
  -webkit-touch-callout:none!important;
}
body input, body textarea, body select,
body [contenteditable]:not([contenteditable="false"]),
body [contenteditable]:not([contenteditable="false"]) *,
body [role="textbox"], body [role="textbox"] *{
  -webkit-user-select:text!important;
  user-select:text!important;
  -webkit-touch-callout:default!important;
}
/* Original rapid-slot controls stay unchanged and remain above this existing button. */
#calendarPage .v54-other-jobs-row{
  display:flex;align-items:center;justify-content:flex-start;
  min-width:0;margin:4px 0 3px;padding:0;
}
#calendarPage .v54-other-jobs-row #v52OtherJobsOpen{
  min-height:32px!important;margin:0!important;
}
@media screen and (max-width:760px){
  /* Old heading retains the configurator hook, but has no visible contents on mobile. */
  #calendarPage .v26-quick-heading{display:none!important}
  #calendarPage .v54-other-jobs-row{margin:3px 0 2px!important}
}
@media screen and (max-width:760px) and (max-height:750px){
  #calendarPage .v54-other-jobs-row{margin:2px 0 1px!important}
  #calendarPage .v54-other-jobs-row #v52OtherJobsOpen{min-height:30px!important;padding:3px 8px!important}
}
@media print{
  body,body *,body *::before,body *::after{
    -webkit-user-select:text!important;user-select:text!important;
  }
}

/* Build 91 TEST — Fase 17A. Stable preview and action slots for every day type.
   Long details/status remain in the existing scroll body; no content is removed. */
@media screen {
 #calendarPage #calendarPreview.calendar-preview.v30-day-preview {
  display:flex!important;flex-direction:column!important;
  height:var(--lmo86-preview-h,131px)!important;
  max-height:var(--lmo86-preview-h,131px)!important;min-height:0!important;
  overflow:hidden!important;
 }
 #calendarPage #calendarPreview>.calendar-preview-title {flex:0 0 auto!important}
 #calendarPage #calendarPreview>.v53-preview-body {
  flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;
  overflow-x:hidden!important;overscroll-behavior:contain;touch-action:pan-y;
 }
 #calendarPage #calendarPreview>.preview-actions.v29-day-actions {
  display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;
  grid-template-rows:37px;flex:0 0 37px!important;align-items:stretch!important;
 }
 #calendarPage #calendarPreview>.preview-actions>button {
  width:100%!important;min-width:0!important;max-width:100%!important;
  height:37px!important;min-height:37px!important;max-height:37px!important;
 }
 #calendarPage #dayEditAction {grid-column:1;grid-row:1}
 #calendarPage #dayAddAnother {grid-column:2;grid-row:1}
 #calendarPage #lmo75CopyDay,#calendarPage #lmo75PasteDay {grid-column:3;grid-row:1}
 #calendarPage #v29DeleteDay {grid-column:4;grid-row:1}
}
@media screen and (min-width:761px) {
 #calendarPage #calendarPreview.calendar-preview.v30-day-preview {
  height:146px!important;max-height:146px!important;
 }
}
