/* Le Mie Ore · Build 57 TEST — layout adattivo, nessuna logica modificata.
 * I breakpoints sono dimensioni CSS del viewport, NON identificazioni per marca/modello.
 * Salvataggi, colori, temi e comportamento dei pannelli rimangono quelli esistenti.
 */
@media screen and (max-width:760px){
  /* Legenda rimossa dall'interfaccia: i colori e i badge dei giorni restano attivi. */
  #calendarPage .legend{display:none!important}
  /* Bilanci e comandi rimangono in alto e affiancati; elimina margini ereditati. */
  #calendarPage .v51-calendar-overview{margin-block:3px!important;row-gap:3px!important}
  #calendarPage .v26-quick-heading{margin-block:2px!important}
  #calendarPage .v22-smart-tools.v29-one-row-actions{margin-block:3px!important}
  /* Compatta senza stringere il testo nelle celle: nessun overflow laterale. */
  #calendarPage #calendar{max-width:100%!important;min-width:0!important}
  #calendarPage #calendar .day{min-width:0!important;overflow:hidden}
  #calendarPage #v26QuickGrid{min-width:0!important;max-width:100%!important}
}
/* iPhone 14, 15, 16e e Galaxy S23/S24/S25: viewport sotto i 400 CSS px */
@media screen and (min-width:361px) and (max-width:399px) and (max-height:850px){
  #calendarPage .v30-day-preview{margin-block:3px!important}
  #calendarPage .v29-one-row-actions button{font-size:clamp(9px,2.6vw,11px)!important}
}
/* Classi Plus, Pro Max, Ultra: più respiro ai controlli senza ingrandire la schermata. */
@media screen and (min-width:412px) and (max-width:760px) and (min-height:820px){
  #calendarPage .v51-calendar-overview{column-gap:7px!important}
  #calendarPage .v26-quick-grid{gap:4px!important}
}
/* Display più bassi o browser con barre visibili: priorità ai comandi e ai giorni. */
@media screen and (max-width:760px) and (max-height:715px){
  #calendarPage .v51-calendar-overview{margin-block:2px!important}
  #calendarPage .v26-quick-heading{min-height:22px!important;margin:1px 0!important}
  #calendarPage .v22-smart-tools.v29-one-row-actions{margin:1px 0!important}
}
@media print{#calendarPage .legend{display:none!important}}

/* Build 93 TEST · Fase 17C: spacing and safe-area polish only. */
@media screen {
 #calendarPage #v22QuickAbsences:empty {display:none!important;margin:0!important;padding:0!important}
 /* Reuse the existing + and its handler, in normal flow: no covered cells. */
 body.v21-calendar-active:not(.v21-editor-open) #calendarPage #v21AddDay:not([hidden]) {
  display:grid!important;place-items:center!important;position:static!important;
  inset:auto!important;transform:none!important;float:none!important;
  width:44px!important;height:44px!important;min-height:44px!important;
  margin:8px max(12px,env(safe-area-inset-right,0px)) 0 auto!important;
  padding:0!important;line-height:1!important;font-size:28px!important;
  border-radius:12px!important;background:var(--v24-buttons,#b64f7b)!important;
  color:var(--v24-btn-text,#fff)!important;
 }
}
@media screen and (max-width:760px) {
 body #appShell>.accountBar.fase1-topbar {
  min-height:calc(54px + env(safe-area-inset-top,0px))!important;
  padding-top:calc(5px + env(safe-area-inset-top,0px))!important;
 }
 body.v21-calendar-active #appShell #calendarPage {
  padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))!important;
 }
 body.v21-calendar-active #appShell #calendarPage>.card:first-child {
  padding-left:max(8px,env(safe-area-inset-left,0px))!important;
  padding-right:max(8px,env(safe-area-inset-right,0px))!important;
 }
 body.v23-shell-active:not(.v21-calendar-active) #appShell>.page:not([hidden]) {
  padding-left:max(10px,env(safe-area-inset-left,0px))!important;
  padding-right:max(10px,env(safe-area-inset-right,0px))!important;
 }
 body.v23-shell-active:not(.v21-calendar-active) #appShell>.nav {
  padding-left:max(5px,env(safe-area-inset-left,0px))!important;
  padding-right:max(5px,env(safe-area-inset-right,0px))!important;
 }
}
@media screen {
 body.v24-unified:not(.v22-night) #calendarPage #calendar .day:not(.work):not(.only-planned):not(.mixed-planned):not(.ferie):not(.malattia):not(.permesso):not(.riposo):not(.fest):not(:has(>small)) {
  color:var(--lmo93-calendar-text,var(--v24-card-text,#58394b))!important;
 }
 /* The desktop label is retained; only its outside spacing is shortened. */
 #calendarPage .v26-quick-heading {margin:4px 0!important}
}

/* Build94: one fixed month screen. Details retain their existing panels. */
@media screen {
 #calendarPage .v29-one-row-actions,#calendarPage #v22UseLastShift {display:none!important}
 #appShell #calendarPage .f94-footer {
  display:grid!important;grid-template-columns:minmax(0,1.25fr) repeat(2,minmax(0,1fr)) 32px!important;
  gap:3px!important;align-items:center!important;width:100%;min-width:0;
 }
 #appShell #calendarPage .f94-footer:has(.f15c1-day-action) {grid-template-columns:minmax(0,1.25fr) repeat(2,minmax(0,1fr)) 32px 32px!important}
 #appShell #calendarPage .f94-footer #v52OtherJobsOpen {grid-column:1;grid-row:1}
 #appShell #calendarPage .f94-footer #v22OpenDuplicate {grid-column:2;grid-row:1}
 #appShell #calendarPage .f94-footer #v22ConfirmMonth {grid-column:3;grid-row:1}
 #appShell #calendarPage .f94-footer .f15c1-day-action {grid-column:4;grid-row:1}
 #appShell #calendarPage .f94-footer #v21AddDay {grid-column:4;grid-row:1}
 #appShell #calendarPage .f94-footer:has(.f15c1-day-action) #v21AddDay {grid-column:5}
 #appShell #calendarPage .f94-footer #v21AddDay:not([hidden]) {
  width:32px!important;height:32px!important;min-height:32px!important;margin:0!important;
  font-size:24px!important;border-radius:9px!important;box-shadow:none!important;
 }
 #appShell #calendarPage .f94-footer button,#appShell #calendarPage .f94-footer #v52OtherJobsOpen,
 #appShell #calendarPage .f94-footer .f15c1-flower-button {
  width:100%!important;min-width:0!important;max-width:none!important;
  height:32px!important;min-height:32px!important;max-height:32px!important;
  padding:3px 2px!important;font-size:10px!important;line-height:1.1!important;
  white-space:nowrap!important;border-radius:9px!important;
 }
 #appShell #calendarPage .f94-footer .f15c1-day-action {display:block!important;margin:0!important;min-width:0!important}
 #appShell #calendarPage .f94-footer .f15c1-flower-button>span {font-size:20px!important}
 #calendarPage #v26QuickStatus:empty {display:none!important}
 /* Copy state uses the existing action slot, not a squeezed extra panel. */
 #calendarPage #lmo75CopyClear {grid-column:3;grid-row:1;font-size:10px!important;text-decoration:none!important;margin:0!important}
 #calendarPage #calendarPreview .lmo75-copy-status {display:none!important}
 #calendarPage #calendar .f94-day-head {
  display:grid!important;grid-template-columns:14px 16px minmax(0,1fr)!important;
  position:relative!important;align-items:start!important;width:100%!important;
  height:11px!important;min-height:11px!important;flex:0 0 11px!important;
  order:0!important;line-height:11px!important;
 }
 #calendarPage #calendar .f94-day-head .v30-day-number {
  position:static!important;display:block!important;width:14px!important;min-width:0!important;
  font-size:10px!important;line-height:11px!important;text-align:left!important;margin:0!important;
 }
 #calendarPage #calendar .f94-day-head .f17b-type {
  position:static!important;transform:none!important;display:flex!important;align-items:start!important;
  width:16px!important;font-size:9px!important;line-height:11px!important;text-align:left!important;
  margin:0!important;padding:0 0 0 2px!important;
 }
 #calendarPage #calendar .f94-day-head .f17b-more {
  position:static!important;display:inline!important;margin:0!important;padding:0!important;
  font-size:6px!important;line-height:7px!important;vertical-align:top!important;
 }
 #calendarPage #calendar .f94-markers {
  position:absolute!important;right:0!important;top:0!important;width:8px!important;
  display:flex!important;flex-direction:column!important;align-items:center!important;gap:0!important;
 }
 #calendarPage #calendar .f94-markers .f15c1-flower {
  position:static!important;flex:0 0 8px!important;height:8px!important;width:8px!important;font-size:9px!important;line-height:8px!important;
 }
 #calendarPage #calendar .f94-markers .note-indicator,
 #calendarPage #calendar .f94-markers .v31-calendar-mark {
  position:static!important;flex:0 0 6px!important;height:6px!important;width:8px!important;font-size:6px!important;line-height:6px!important;
 }
 #appShell #calendarPage #calendar .day.f17b-cell {
  container-type:size;display:flex!important;flex-direction:column!important;
  padding:1px!important;gap:0!important;min-width:0!important;
  height:100%!important;min-height:0!important;max-height:none!important;
 }
 #appShell #calendarPage #calendar .day .f17b-clock {
  width:100%!important;flex:1 1 auto!important;min-height:0!important;margin:0!important;
  font-size:clamp(9px,23cqh,11px)!important;line-height:1!important;
 }
 #appShell #calendarPage #calendar .day:has(.f94-markers>*) .f17b-clock {width:calc(100% - 8px)!important}
 #appShell #calendarPage #calendar .day .f17b-clock>span {line-height:1!important}
 #appShell #calendarPage #calendar .day .f17b-hours {
  flex:none!important;font-size:clamp(8px,20cqh,10px)!important;line-height:1!important;margin-top:auto!important;
 }
 #appShell #calendarPage #calendar .day .f17b-planned {font-style:normal!important}
 #appShell #calendarPage #calendar .day .f17b-hours>span {line-height:1!important}
 #appShell #calendarPage #calendar .day .mr-day-label {position:static!important;margin:auto 0!important;max-width:100%!important}
 #appShell #calendarPage #calendar .day {background-clip:padding-box}
}
@media screen and (max-width:760px), screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 html:has(body.v21-calendar-active),body.v21-calendar-active {height:100%!important;max-height:100dvh!important;overflow:hidden!important}
 body.v21-calendar-active>header,body.v21-calendar-active>footer,
 body.v21-calendar-active #appShell>.nav {display:none!important}
 body.v21-calendar-active>main,body.v21-calendar-active #appShell {
  height:100dvh!important;max-height:100dvh!important;overflow:hidden!important;
  width:100%!important;max-width:none!important;margin:0!important;padding:0!important;
 }
 body.v21-calendar-active #appShell #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;
  overflow:hidden!important;padding:0 0 max(3px,env(safe-area-inset-bottom,0px))!important;
  touch-action:manipulation!important;
 }
 body.v21-calendar-active #appShell #calendarPage>.card:first-child {
  display:flex!important;flex-direction:column!important;gap:0!important;
  box-sizing:border-box!important;height:100%!important;max-height:100%!important;min-height:0!important;
  width:100%!important;margin:0!important;
  padding:2px max(5px,env(safe-area-inset-right,0px)) 1px max(5px,env(safe-area-inset-left,0px))!important;
  overflow:hidden!important;
 }
 #appShell #calendarPage>.card:first-child>.bar {
  flex:0 0 34px!important;height:34px!important;min-height:34px!important;
  margin:0 0 3px!important;padding:0!important;
 }
 #appShell #calendarPage .bar>button,#appShell #calendarPage .bar #monthName,
 #appShell #calendarPage .bar #todayButton,#appShell #calendarPage .bar #v24CalendarToSummary {
  height:34px!important;min-height:34px!important;max-height:34px!important;
  padding:3px 5px!important;font-size:12px!important;
 }
 #appShell #calendarPage #calendarPreview.calendar-preview.v30-day-preview {
  flex:0 0 84px!important;height:84px!important;min-height:84px!important;max-height:84px!important;
  padding:4px 6px!important;margin:0 0 3px!important;gap:2px!important;
 }
 #appShell #calendarPage #calendarPreview .calendar-preview-title {
  font-size:12px!important;line-height:14px!important;white-space:nowrap!important;
  overflow:hidden!important;text-overflow:ellipsis!important;
 }
 #appShell #calendarPage #calendarPreview .v53-preview-body>p.muted {display:none!important}
 #appShell #calendarPage #calendarPreview .day-preview-shift {
  padding:2px 4px!important;margin:0!important;line-height:1.1!important;font-size:10px!important;
 }
 #appShell #calendarPage #calendarPreview>.preview-actions.v29-day-actions {
  grid-template-rows:28px!important;flex:0 0 28px!important;margin:0!important;gap:4px!important;
 }
 #appShell #calendarPage #calendarPreview>.preview-actions>button {
  height:28px!important;min-height:28px!important;max-height:28px!important;font-size:10px!important;padding:3px 2px!important;
 }
 #appShell #calendarPage #calendar {
  display:grid!important;flex:1 1 0!important;min-height:0!important;
  grid-template-columns:repeat(7,minmax(0,1fr))!important;
  grid-template-rows:12px repeat(var(--f94-rows,6),minmax(0,1fr))!important;
  grid-auto-rows:0;gap:2px!important;margin:0 0 3px!important;
 }
 #appShell #calendarPage #calendar .wd {height:12px!important;padding:0!important;line-height:12px!important;font-size:9px!important}
 #appShell #calendarPage .v51-calendar-overview {
  flex:0 0 38px!important;height:38px!important;min-height:38px!important;
  margin:0 0 3px!important;gap:4px!important;overflow:hidden!important;
 }
 #appShell #calendarPage #mrOvertimeBalance,#appShell #calendarPage .v29-month-toggle {
  box-sizing:border-box!important;height:38px!important;min-height:38px!important;max-height:38px!important;
  margin:0!important;padding:3px 5px!important;font-size:10px!important;line-height:1.1!important;
 }
 #appShell #calendarPage #mrOvertimeBalance {overflow:hidden!important;display:-webkit-box!important;-webkit-line-clamp:2;-webkit-box-orient:vertical}
 #appShell #calendarPage .v29-month-toggle strong {font-size:10px!important}
 #appShell #calendarPage #v26QuickGrid {
  flex:0 0 36px!important;height:36px!important;min-height:36px!important;margin:0 0 3px!important;gap:3px!important;
 }
 #appShell #calendarPage #v26QuickGrid>.v26-quick-button {
  height:36px!important;min-height:36px!important;max-height:36px!important;padding:2px 0!important;
 }
 #appShell #calendarPage .f94-footer {flex:0 0 32px!important;height:32px!important;min-height:32px!important;margin:0!important}
 #appShell #calendarPage .v26-quick-heading {display:none!important}
}
@media screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 body.v21-calendar-active #appShell #calendarPage>.card:first-child {
  display:grid!important;grid-template-columns:minmax(0,1.6fr) minmax(250px,1fr)!important;
  grid-template-rows:34px minmax(0,1fr) 38px 36px 32px!important;gap:3px 6px!important;
 }
 #appShell #calendarPage>.card:first-child>.bar {grid-column:1/-1;grid-row:1;margin:0!important}
 #appShell #calendarPage #calendar {grid-column:1;grid-row:2/6;width:100%;height:100%!important;margin:0!important}
 #appShell #calendarPage #calendarPreview.calendar-preview.v30-day-preview {grid-column:2;grid-row:2;height:100%!important;min-height:0!important;max-height:none!important;margin:0!important}
 #appShell #calendarPage .v51-calendar-overview {grid-column:2;grid-row:3;margin:0!important}
 #appShell #calendarPage #v26QuickGrid {grid-column:2;grid-row:4;margin:0!important}
 #appShell #calendarPage .f94-footer {grid-column:2;grid-row:5}
}
@media screen and (min-width:761px) and (min-height:501px) {
 #appShell #calendarPage #calendar .day.f17b-cell {height:54px!important;min-height:54px!important;max-height:54px!important}
}
/* Dense mixed days retain exact totals in the selected-day preview/accessible label. */
@container (max-height:48px) {
 .f17b-hours:has(.f17b-actual):has(.f17b-planned) {flex-direction:row!important;justify-content:center!important;gap:2px!important}
 .f17b-hours:has(.f17b-actual) .f17b-planned {display:none!important}
 .f17b-hours:has(.f17b-actual):has(.f17b-planned)::after {content:'+P';font-size:8px;line-height:1}
}
@media screen {
 #appShell #calendarPage #calendarPreview .v53-preview-body>p.muted {display:block!important;font-size:9px!important;line-height:10px!important;margin:0!important}
 #appShell #calendarPage #calendarPreview .day-preview-shift>div {display:flex!important;align-items:center!important;min-width:0!important;gap:5px!important}
 #appShell #calendarPage #calendarPreview .day-preview-shift b {font-size:9px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;min-width:0!important}
 #appShell #calendarPage #calendarPreview .day-preview-shift>div>div {font-size:9px!important;line-height:11px!important;white-space:nowrap!important}
 #appShell #calendarPage #calendarPreview .confirm-shift {min-height:22px!important;height:22px!important;font-size:9px!important;padding:2px 4px!important}
 #appShell #calendarPage #calendar .f17b-clock:has(.f17b-cell-absence) {display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;gap:0 1px!important;align-content:center!important;align-items:center!important;font-size:8px!important}
 #appShell #calendarPage #calendar .f17b-clock .f17b-cell-absence {grid-column:1;grid-row:1/3;font-size:7px!important;max-width:15px!important}
 #appShell #calendarPage #calendar .f17b-clock:has(.f17b-cell-absence)>span:not(.f17b-cell-absence) {grid-column:2}
}
@media screen {
 #appShell #calendarPage .v22-smart-tools.v29-one-row-actions {display:none!important;margin:0!important;padding:0!important}
}
@media screen and (max-width:760px), screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 html body.v21-calendar-active #appShell #calendarPage.page {overflow:hidden!important;touch-action:manipulation!important}
}
@media screen {
 #appShell #calendarPage #calendar .day .f17b-clock-split {font-size:clamp(8px,18cqh,10px)!important}
 #appShell #calendarPage #calendar .day .f17b-hours:has(.f17b-actual):has(.f17b-planned) {font-size:clamp(7.5px,17cqh,9px)!important}
}
@media screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 #appShell #calendarPage #calendar .day .f17b-clock-split:not(:has(.f17b-cell-absence)) {flex-direction:row!important;gap:0!important}
 #appShell #calendarPage #calendar .day .f17b-clock-split:not(:has(.f17b-cell-absence))>span {display:inline!important}
 #appShell #calendarPage #calendar .day .f17b-clock-split:not(:has(.f17b-cell-absence))>span+span::before {content:'–'}
}
@media screen {
 #appShell #calendarPage #calendar .f94-day-head .v30-day-number {
  margin:0!important;width:13px!important;min-width:13px!important;max-width:13px!important;
  font-size:10px!important;line-height:11px!important;
 }
 #appShell #calendarPage #calendar .f94-day-head .f17b-type {margin:0!important;font-size:9px!important;line-height:11px!important}
}
@media screen {
 #appShell #calendarPage .v21-calendar-head {display:none!important}
}
@media screen and (max-width:760px), screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 #appShell #calendarPage #v52Panel[open] {
  position:fixed!important;inset:0!important;transform:none!important;
  margin:0!important;width:100vw!important;max-width:100vw!important;
  height:100dvh!important;max-height:100dvh!important;border-radius:0!important;padding:0!important;
 }
 #appShell #calendarPage #v52Panel .v52-screen {height:100dvh!important;max-height:100dvh!important}
 #appShell #calendarPage #v52Panel .v52-head {
  padding:calc(9px + env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) 10px max(12px,env(safe-area-inset-left,0px))!important;
 }
}
@media screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 #appShell #calendarPage #calendar .day .f17b-clock-split {letter-spacing:-.3px!important}
}
@media screen and (max-width:760px), screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px) {
 #appShell #calendarPage #calendarPreview .v53-preview-body>p.f94-preview-company {display:none!important}
}
@media screen {
 #calendarPage #v29MonthDetails #f15c1Legend {
  display:flex!important;flex-wrap:wrap!important;height:auto!important;min-height:16px!important;
  margin:5px 0!important;padding:0!important;
 }
}
@media screen {
 #appShell #calendarPage #calendar .day .mr-day-label {
  position:static!important;inset:auto!important;transform:none!important;
  align-self:center!important;width:auto!important;max-width:calc(100% - 4px)!important;
  margin:auto!important;
 }
}

/* Build95: horizontal dates on mobile Safari; enough room for the planned-row action. */
@media screen {
 #appShell #calendarPage {
  -webkit-text-size-adjust:100%;text-size-adjust:100%;
 }
 #appShell #calendarPage #calendar .day.f17b-cell {padding-inline:0!important}
 #appShell #calendarPage #calendar .f94-day-head {
  grid-template-columns:16px 16px minmax(0,1fr)!important;
  height:12px!important;min-height:12px!important;flex-basis:12px!important;
 }
 #appShell #calendarPage #calendar .f94-day-head .v30-day-number {
  display:block!important;width:16px!important;min-width:16px!important;max-width:16px!important;
  font-size:11px!important;line-height:12px!important;
  white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;
 }
 #appShell #calendarPage #calendar .f94-day-head .f17b-type {line-height:12px!important}
}
@media screen and (max-width:760px) and (min-height:501px) {
 #appShell #calendarPage #calendarPreview.calendar-preview.v30-day-preview {
  flex-basis:100px!important;height:100px!important;min-height:100px!important;max-height:100px!important;
 }
}
