/* Build 52 TEST · detail panels, native safe areas; no duplicated app controls. */
@media screen and (max-width:760px), screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px){
  body.v21-calendar-active #calendarPage .v52-dialog{
    position:fixed;inset:0;margin:0;width:100%;max-width:100%;height:100dvh;max-height:100dvh;
    border:0;border-radius:0;padding:0;box-shadow:none;overflow:hidden;
    background:var(--v24-card,#fff9fc);color:var(--v24-card-text,#59374c);
  }
  body.v21-calendar-active #calendarPage .v52-dialog::backdrop{background:rgba(47,25,41,.40)}
  #calendarPage .v52-screen{display:flex;flex-direction:column;height:100dvh;max-height:100dvh;min-width:0}
  #calendarPage .v52-head{
    display:grid;grid-template-columns:46px minmax(0,1fr) 46px;align-items:center;gap:8px;
    padding:calc(9px + env(safe-area-inset-top,0px)) 12px 10px;
    border-bottom:1px solid color-mix(in srgb,var(--v24-primary,#b64f7b) 30%,transparent);
    background:var(--v24-card,#fff9fc);flex:0 0 auto;min-height:60px;
  }
  #calendarPage .v52-head strong{font-size:clamp(15px,4.1vw,18px);text-align:center;white-space:normal;line-height:1.2;overflow-wrap:anywhere}
  #calendarPage .v52-head button{width:44px;height:44px;min-height:44px;display:grid;place-items:center;font-size:25px;line-height:1;padding:0;border-radius:14px}
  #calendarPage .v52-head button[hidden]{visibility:hidden;display:block!important;pointer-events:none}
  #calendarPage .v52-content{flex:1 1 0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;min-height:0;padding:12px 14px calc(25px + env(safe-area-inset-bottom,0px));min-width:0}
  #calendarPage .v52-content > *{min-width:0;max-width:100%}
  #calendarPage .v52-content .v29-month-details{display:block;position:static;margin:0;border:0;background:transparent;padding:0;border-radius:0}
  #calendarPage .v52-content .v29-month-title button{display:none}
  #calendarPage .v52-content .v29-month-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  #calendarPage .v52-content #v16AdditionalCard{display:block!important;margin:0!important;padding:8px!important;box-shadow:none!important}
  #calendarPage .v52-content #v16AdditionalCard>summary{display:none!important}
  #calendarPage .v52-content .v16-entry{min-width:0;overflow-wrap:anywhere}
  #calendarPage #v52OtherJobsOpen{width:auto;min-height:32px;padding:5px 9px;font-size:12px;white-space:nowrap}
  #calendarPage .v26-quick-heading{margin:4px 0 2px!important;justify-content:flex-end!important}
  #calendarPage .v26-quick-heading #v26QuickConfigure{display:none!important}
  #calendarPage .v26-quick-heading strong{display:none!important}
  #calendarPage .v52-rol-balances{display:grid;gap:8px;margin:10px 0 16px}
  #calendarPage .v52-rol-card,#calendarPage .v52-rol-entry{padding:11px 12px;border:1px solid color-mix(in srgb,var(--v24-primary,#b64f7b) 40%,transparent);background:var(--v24-secondary,#fff1f7);border-radius:13px}
  #calendarPage .v52-rol-card strong{display:block;font-size:14px}
  #calendarPage .v52-rol-entry-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
  #calendarPage .v52-rol-entry-head b{white-space:nowrap;color:var(--v24-primary,#a44573)}
  #calendarPage .v52-rol-card p,#calendarPage .v52-rol-entry p{font-size:13px;margin:5px 0 0;line-height:1.4;overflow-wrap:anywhere}
  #calendarPage .v52-rol-list{display:grid;gap:7px}
  #calendarPage .v52-content h3{font-size:16px;margin:14px 0 9px}
  #calendarPage .v52-empty,#calendarPage .v52-muted{font-size:13px;line-height:1.5;color:var(--v24-card-text,#735668)}
  #calendarPage #mrOvertimeBalance{cursor:pointer;touch-action:manipulation}
  #calendarPage #mrOvertimeBalance:focus-visible{outline:3px solid #255cb8;outline-offset:2px}
  #calendarPage .v52-dialog:not([open]){display:none!important}
  /* Keep the six quick slots accessible, but shrink the regular calendar where possible. */
  body.v21-calendar-active #calendarPage .day{height:clamp(34px,calc((100dvh - 450px)/6),44px)!important;min-height:clamp(34px,calc((100dvh - 450px)/6),44px)!important;max-height:clamp(34px,calc((100dvh - 450px)/6),44px)!important}
  body.v21-calendar-active #calendarPage .calendar-preview.v30-day-preview{margin:3px 0!important}
  body.v21-calendar-active #calendarPage .v22-smart-tools.v29-one-row-actions{margin:3px 0 1px!important}
  body.v21-calendar-active #calendarPage .v26-quick-grid>.v26-quick-button{min-height:44px!important;max-height:48px!important}
}
@media screen and (min-width:761px){
 #calendarPage .v52-dialog{position:fixed;left:50%;top:3vh;transform:translateX(-50%);width:min(700px,96vw);max-height:94vh;border:1px solid #e8c1d3;border-radius:18px;padding:0;overflow:hidden;color:var(--v24-card-text,#59374c);background:var(--v24-card,#fff9fc)}
 #calendarPage .v52-screen{display:flex;flex-direction:column;height:min(90vh,780px)}
 #calendarPage .v52-head{display:grid;grid-template-columns:46px minmax(0,1fr) 46px;align-items:center;padding:10px;gap:8px;border-bottom:1px solid #e8c1d3}
 #calendarPage .v52-head strong{text-align:center}
 #calendarPage .v52-content{overflow-y:auto;flex:1;padding:12px 18px}
 #calendarPage .v52-content #v16AdditionalCard>summary{display:none}
 #calendarPage .v52-content .v29-month-title button{display:none}
 #calendarPage .v52-dialog:not([open]){display:none}
 #calendarPage .v26-quick-heading #v26QuickConfigure{display:none!important}
}
@media print{#calendarPage .v52-dialog,#calendarPage #v52OtherJobsOpen{display:none!important}}
@media screen and (max-width:760px), screen and (orientation:landscape) and (max-height:500px) and (max-width:1024px){
 /* Do not reserve an additional empty 96px at the bottom of the calendar.
    The floating + keeps its normal hit area while compact controls remain visible. */
 body.v21-calendar-active #calendarPage{padding-bottom:calc(64px + env(safe-area-inset-bottom,0px))!important}
}
