/* Size the attendance flow from the space left above the navigation, not 100vh. */
@media screen and (max-width:1099px) {
  :root body.worker-app[data-worker-workspace] #patrol-main:has(.attendance-simple,.attendance-success) {
    overscroll-behavior:none;
    padding:clamp(4px,1.2dvh,12px) max(8px,env(safe-area-inset-right)) clamp(4px,1.2dvh,12px) max(8px,env(safe-area-inset-left));
  }
  :root body.worker-app[data-worker-workspace] #patrol-content:has(>.attendance-simple,>.attendance-success) {
    flex:1; min-height:0; height:100%; max-width:680px;
    container-type:size; container-name:attendance;
  }
  :root body.worker-app[data-worker-workspace] #patrol-content > :is(.attendance-simple,.attendance-success) {
    --attendance-gap:clamp(4px,1.2cqh,10px);
    flex:1; width:100%; min-height:0; max-width:680px!important;
    margin:0; padding:clamp(8px,2cqh,20px); gap:var(--attendance-gap);
  }
  :root body.worker-app[data-worker-workspace] #attendance-form { display:flex; flex-direction:column; }
  :root body.worker-app[data-worker-workspace] .attendance-panel-header { flex:none; margin:0; gap:8px; }
  :root body.worker-app[data-worker-workspace] .attendance-panel-header h2 { margin:0; font-size:clamp(20px,3.4cqh,26px); }
  :root body.worker-app[data-worker-workspace] .attendance-panel-header p { margin:4px 0 0; font-size:12px; line-height:1.4; }
  :root body.worker-app[data-worker-workspace] .attendance-record-link { min-height:44px; padding:6px 10px; font-size:12px; }
  :root body.worker-app[data-worker-workspace] .business-attendance-steps { flex:none; margin:0; gap:4px; }
  :root body.worker-app[data-worker-workspace] .business-attendance-steps li { gap:4px; font-size:11px; }
  :root body.worker-app[data-worker-workspace] #attendance-fields {
    display:flex; flex-direction:column; flex:1; min-height:0; min-width:0; margin:0; padding:0; gap:var(--attendance-gap);
  }
  :root body.worker-app[data-worker-workspace] .attendance-simple:not([data-phase=choose]) .attendance-start {
    flex:1; min-height:0; padding:0; gap:6px;
  }
  :root body.worker-app[data-worker-workspace] .attendance-start.business-location-card { padding:0!important; margin:0!important; }
  :root body.worker-app[data-worker-workspace] .attendance-simple:not([data-phase=choose]) .attendance-stage {
    flex:0 1 auto; width:clamp(80px,calc(100cqh - 300px),260px); min-height:80px; margin:0 auto;
  }
  :root body.worker-app[data-worker-workspace] #attendance-location { margin:0; font-size:12px; line-height:1.4; }
  :root body.worker-app[data-worker-workspace] .attendance-start > small { font-size:11px; line-height:1.4; }
  :root body.worker-app[data-worker-workspace] .attendance-simple[data-phase=choose] .attendance-start {
    flex:none; min-height:44px; padding:0; gap:8px;
  }
  :root body.worker-app[data-worker-workspace] .attendance-simple[data-phase=choose] .attendance-start > small { display:none; }
  :root body.worker-app[data-worker-workspace] .attendance-simple[data-phase=choose] #attendance-choose:not([hidden]) {
    min-height:0; flex:1; display:grid; grid-template-columns:minmax(0,1fr) auto;
    grid-template-rows:minmax(0,1fr) auto auto; gap:4px 6px;
  }
  :root body.worker-app[data-worker-workspace] #attendance-targets {
    grid-column:1/-1; grid-row:1; min-height:0; gap:6px; grid-auto-rows:minmax(min-content,1fr);
  }
  :root body.worker-app[data-worker-workspace] .attendance-parcel { min-height:44px; padding:6px 24px 6px 8px; }
  :root body.worker-app[data-worker-workspace] .attendance-parcel strong { font-size:13px; line-height:1.3; }
  :root body.worker-app[data-worker-workspace] .attendance-parcel small { font-size:11px; line-height:1.3; }
  :root body.worker-app[data-worker-workspace] .attendance-parcel-check { top:8px; right:8px; }
  :root body.worker-app[data-worker-workspace] #attendance-selection { grid-column:1; grid-row:2; margin:0; font-size:11px; line-height:1.35; }
  :root body.worker-app[data-worker-workspace] #attendance-pages { grid-column:2; grid-row:2; margin:0; gap:2px; }
  :root body.worker-app[data-worker-workspace] #attendance-pages button { min-height:44px; min-width:44px; padding:4px; }
  :root body.worker-app[data-worker-workspace] #attendance-choose > footer { grid-column:1/-1; grid-row:3; margin:0; padding:0; }
  :root body.worker-app[data-worker-workspace] #attendance-submit { min-height:44px; }
  :root body.worker-app[data-worker-workspace] :is(#attendance-error,#attendance-nearby-note) { margin:0; font-size:12px; line-height:1.4; }
  :root body.worker-app[data-worker-workspace] .attendance-metrics { flex:none; grid-template-columns:minmax(0,1fr) minmax(0,1.6fr); margin:0; gap:6px; }
  :root body.worker-app[data-worker-workspace] .attendance-metric { padding:8px; }
  :root body.worker-app[data-worker-workspace] .attendance-metric > span { font-size:11px; line-height:1.3; margin-bottom:3px; }
  :root body.worker-app[data-worker-workspace] .attendance-metric p { margin:0; }
  :root body.worker-app[data-worker-workspace] .attendance-metric small { font-size:11px; line-height:1.3; }
  :root body.worker-app[data-worker-workspace] #attendance-month-count { font-size:24px; }
  :root body.worker-app[data-worker-workspace] #attendance-coordinates { font-size:12px; line-height:1.35; margin-bottom:3px; }
  :root body.worker-app[data-worker-workspace] .attendance-metric:has(#attendance-count-retry[hidden]) #attendance-count-status { display:none; }
  :root body.worker-app[data-worker-workspace] .attendance-success { display:grid; grid-template-columns:44px minmax(0,1fr); align-content:center; }
  :root body.worker-app[data-worker-workspace] .attendance-success > * { grid-column:1/-1; }
  :root body.worker-app[data-worker-workspace] .attendance-success-mark { grid-column:1; grid-row:2; width:44px; height:44px; margin:0; }
  :root body.worker-app[data-worker-workspace] .attendance-success-mark svg { width:32px; height:32px; }
  :root body.worker-app[data-worker-workspace] #attendance-success-title { grid-column:2; grid-row:2; align-self:center; margin:0; font-size:24px; }
  :root body.worker-app[data-worker-workspace] .attendance-success .attendance-success-parcel { font-size:20px; line-height:1.3; }
  :root body.worker-app[data-worker-workspace] .attendance-success > p { margin:0; font-size:12px; line-height:1.4; }
  :root body.worker-app[data-worker-workspace] .attendance-success .patrol-notice { display:none; }
  :root body.worker-app[data-worker-workspace] .attendance-success > a.button { grid-column:1/-1; min-width:0; width:100%; min-height:44px; }
  :root body.worker-app[data-worker-workspace] .attendance-success > a.attendance-success-details { color:var(--ink); background:var(--panel); border:1px solid var(--line); box-shadow:none; }
}
@media screen and (max-width:1099px) and (max-height:600px) {
  :root body.worker-app[data-worker-workspace] .business-attendance-steps,
  :root body.worker-app[data-worker-workspace] .attendance-panel-header p { display:none; }
  :root body.worker-app[data-worker-workspace] .attendance-metric { padding:6px 8px; }
  :root body.worker-app[data-worker-workspace] .attendance-success > a.button:not(.attendance-success-details) { grid-column:1; min-width:100px; }
  :root body.worker-app[data-worker-workspace] .attendance-success > a.attendance-success-details { grid-column:2; }
  :root body.worker-app[data-worker-workspace] .attendance-success { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  :root body.worker-app[data-worker-workspace] .attendance-success-mark { justify-self:center; }
}
@media screen and (min-width:480px) and (max-width:1099px) and (max-height:500px) {
  :root body.worker-app[data-worker-workspace] #attendance-form { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.3fr); grid-template-rows:auto minmax(0,1fr) auto auto; gap:8px; }
  :root body.worker-app[data-worker-workspace] #attendance-form > .attendance-panel-header { grid-column:1; grid-row:1; }
  :root body.worker-app[data-worker-workspace] #attendance-fields { display:contents; }
  :root body.worker-app[data-worker-workspace] .attendance-start { grid-column:2; grid-row:1; }
  :root body.worker-app[data-worker-workspace] .attendance-simple:not([data-phase=choose]) .attendance-start { grid-row:1/5; }
  :root body.worker-app[data-worker-workspace] #attendance-choose:not([hidden]) { grid-column:2; grid-row:2/5; }
  :root body.worker-app[data-worker-workspace] #attendance-nearby-note { grid-column:1; grid-row:3; }
  :root body.worker-app[data-worker-workspace] #attendance-error { grid-column:1; grid-row:4; }
  :root body.worker-app[data-worker-workspace] #attendance-form > .attendance-metrics { grid-column:1; grid-row:2; align-self:start; }
  :root body.worker-app[data-worker-workspace] #attendance-targets { grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; }
  :root body.worker-app[data-worker-workspace] .attendance-parcel:last-child:nth-child(odd) { grid-column:auto; }
  :root body.worker-app[data-worker-workspace] .attendance-simple:not([data-phase=choose]) .attendance-stage { width:clamp(80px,calc(100cqh - 120px),200px); }
  :root body.worker-app[data-worker-workspace] .attendance-panel-header h2 { font-size:18px; }
  :root body.worker-app[data-worker-workspace] .attendance-record-link { padding:6px; font-size:11px; }
  :root body.worker-app[data-worker-workspace] .attendance-success { grid-template-columns:44px minmax(0,1fr) minmax(0,1.1fr); grid-template-rows:auto auto auto auto auto; }
  :root body.worker-app[data-worker-workspace] .attendance-success-mark { grid-column:1; grid-row:2/4; align-self:center; }
  :root body.worker-app[data-worker-workspace] #attendance-success-title { grid-column:2; grid-row:2; font-size:22px; text-align:left; }
  :root body.worker-app[data-worker-workspace] .attendance-success-parcel { grid-column:2; grid-row:3; }
  :root body.worker-app[data-worker-workspace] .attendance-success > p:not([class]) { grid-column:1/3; grid-row:4; }
  :root body.worker-app[data-worker-workspace] .attendance-success > .attendance-metrics { grid-column:3; grid-row:2/5; align-self:center; }
  :root body.worker-app[data-worker-workspace] .attendance-success > a.button:not(.attendance-success-details) { grid-column:1/3; grid-row:5; }
  :root body.worker-app[data-worker-workspace] .attendance-success > a.attendance-success-details { grid-column:3; grid-row:5; }
}
