/* The operational set editor is a form, not the wide history table. */
.set-editor.progress-table { min-width: 0; width: 100%; }
@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
  .content { padding: 12px 10px calc(132px + env(safe-area-inset-bottom)); }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; padding: 5px; overflow: visible; }
  .mobile-nav .nav-btn { min-width: 0; min-height: 44px; padding: 4px; font-size: 11px; overflow-wrap: anywhere; }
  input, select, textarea { min-width: 0; max-width: 100%; font-size: 16px; }
  button, input, select, textarea { scroll-margin-bottom: calc(132px + env(safe-area-inset-bottom)); }
  #sheetView { gap: 10px; }
  #sheetView .client-focus { padding: 12px; gap: 8px; }
  #sheetView .client-focus h2 { font-size: 22px; margin-bottom: 4px; }
  #sheetView .client-focus p { font-size: 13px; line-height: 1.4; }
  #sheetView .client-focus .btn { padding: 7px 10px; min-height: 44px; font-size: 12px; }
  #sheetView .presentation-head { padding: 12px; gap: 8px; }
  #sheetView .presentation-head h1 { font-size: 24px; }
  #sheetView .presentation-head p { font-size: 12px; }
  #sheetView .view-kicker { font-size: 10px; margin-bottom: 4px; }
  #sheetView .presentation-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 12px; gap: 6px; }
  #sheetView .presentation-meta div { min-width: 0; padding: 7px; overflow-wrap: anywhere; }
  #sheetView .presentation-meta span { font-size: 9px; }
  #sheetView .presentation-meta strong { font-size: 12px; }
  #sheetView .week-navigator { margin: 10px 10px 0; padding: 8px; gap: 8px; }
  #sheetView .week-navigator-head { gap: 8px; font-size: 13px; }
  #sheetView .week-navigator-head span { font-size: 11px; }
  #sheetView .week-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  #sheetView .week-button { min-width: 0; min-height: 44px; padding: 6px 8px; font-size: 12px; }
  #sheetView .readonly-exercise-stack { padding: 10px; gap: 10px; }
  #sheetView .readonly-exercise-head { padding: 8px; gap: 7px; }
  #sheetView .readonly-exercise-body { padding: 7px; gap: 7px; }
  #sheetView .readonly-exercise-head strong { font-size: 14px; overflow-wrap: anywhere; }
  #sheetView .set-editor-head { padding: 8px; gap: 8px; }
  #sheetView .set-editor-head > div { min-width: 0; }
  #sheetView .set-editor-head .btn { min-height: 44px; padding: 6px 10px; font-size: 12px; }
  #sheetView .workout-date-field { margin: 0; grid-template-columns: auto minmax(0, 1fr); }
  #sheetView .set-list { padding: 6px; gap: 7px; }
  #sheetView .set-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 7px; }
  #sheetView .set-number { grid-column: 1 / 3; grid-row: 1; font-size: 13px; }
  #sheetView .set-remove { grid-column: 3; grid-row: 1; width: 44px; height: 44px; }
  #sheetView .set-field { min-width: 0; }
  #sheetView .set-field input { width: 100%; min-width: 0; min-height: 44px; padding: 6px; font-size: 16px; }
  #sheetView .set-editor.compact .set-field label { display: block; }
  #sheetView .set-note-field { grid-column: 1 / -1; }
  #sheetView .set-previous { grid-column: 1 / -1; overflow-wrap: anywhere; }
  #sheetView .program-save-footer { padding: 12px; gap: 8px; flex-wrap: wrap; }
  #sheetView .program-save-footer span { font-size: 12px; }
  #sheetView .program-save-footer .btn { min-height: 44px; }
}

@media (max-width: 760px) {
  #sheetView .set-row .set-field input { margin: 0; }
}

/* Keep fixed navigation away from the keyboard and the field being edited. */
@media (max-width: 1160px) {
  #appShell:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) .mobile-nav { display: none; }
  body:has(dialog[open]) .mobile-nav { display: none; }
}
