/* The editor owns the viewport; only the form fields scroll. */
body:not(.auth-locked) #work-order-mobile-sheet:not([hidden]) {
  position: fixed;
  inset: 0;
  top: var(--mobile-visual-top, 0px) !important;
  width: 100%;
  height: var(--mobile-visual-height, 100dvh);
  max-height: var(--mobile-visual-height, 100dvh);
  padding: 0 !important;
  align-items: stretch;
  justify-content: stretch;
}
body:not(.auth-locked) #work-order-mobile-sheet {
  --editor-gutter: 32px;
  & *, & *::before, & *::after { box-sizing: border-box; letter-spacing: 0; }
  & .mobile-shell-sheet-backdrop { display: none; }
  & .work-order-mobile-sheet-panel {
    position: relative;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    border: 0;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none;
    animation: none;
    transform: none;
    backdrop-filter: none;
  }
  & .work-order-mobile-sheet-panel::before,
  & .work-order-mobile-sheet-panel::after { display: none; }
  & .mobile-shell-sheet-header::before { display: none; }
  & .mobile-shell-sheet-header {
    position: static;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: max(18px, var(--safe-area-top, 0px)) var(--editor-gutter) 18px;
    border-bottom: 1px solid #dce6ea;
    background: #fff;
    backdrop-filter: none;
  }
  & .mobile-shell-sheet-header h2 { margin: 2px 0 0; font-size: 28px; line-height: 1.25; }
  & .mobile-shell-sheet-header .eyebrow { margin: 0; }
  & .work-order-mobile-sheet-host {
    height: 100%;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden !important;
  }
  & #work-order-form {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0;
    padding: 0 !important;
  }
  & #work-order-form .report-form-topline { padding: 14px var(--editor-gutter); }
  & #work-order-form .report-form-topline .small-copy { max-width: none; line-height: 1.5; }
  & #work-order-form > .work-order-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-areas: "setup responsibility notes";
    align-content: start;
    align-items: start;
    gap: 28px;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 12px var(--editor-gutter) 32px !important;
    scroll-padding: 20px;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
  }
  & .work-order-form-column { gap: 28px; }
  & .work-order-form-section { gap: 14px; }
  & :is(.work-order-form-section-heading, .work-order-link-section-header) h4 { margin: 0 0 6px; font-size: 16px; line-height: 1.4; }
  & :is(.work-order-form-section-heading, .work-order-link-section-header) .eyebrow { margin: 0 0 4px; }
  & .work-order-form-section-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  & .work-order-form-section-notes label { grid-column: auto !important; }
  & .work-order-form-section-notes .work-order-form-section-heading { grid-column: 1 / -1; }
  & #work-order-form textarea { min-height: 112px; max-height: none; resize: vertical; }
  & #work-order-form :is(input:not([type="checkbox"]):not([type="file"]), select, textarea) { border-radius: 6px; }
  & #work-order-form .form-row { gap: 12px; }
  & .work-order-form-section-crew .work-order-crew-picker { max-height: none; overflow: visible; }
  & .work-order-photo-preview { max-height: none; overflow: visible; }
  & #work-order-form .form-actions {
    position: static !important;
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    min-height: 72px;
    padding: 14px var(--editor-gutter) max(14px, var(--safe-area-bottom, 0px)) !important;
    margin: 0;
    border-top: 1px solid #dce6ea;
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
  }
  & #work-order-form .form-actions button { min-height: 44px; border-radius: 6px; padding-inline: 22px; }
  & #work-order-submit { background: #087f8c; color: #fff; border: 1px solid #087f8c; box-shadow: none; }
  & #work-order-submit:hover:not(:disabled) { background: #066b76; }
}
@media (max-width: 1179px) and (min-width: 801px) {
  body:not(.auth-locked) #work-order-mobile-sheet #work-order-form > .work-order-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "setup responsibility" "notes notes";
  }
}
@media (max-width: 800px) {
  body:not(.auth-locked) #work-order-mobile-sheet {
    --editor-gutter: 16px;
    & .mobile-shell-sheet-header { padding-block: max(10px, var(--safe-area-top, 0px)) 10px; gap: 10px; }
    & .mobile-shell-sheet-header h2 { font-size: 22px; }
    & #work-order-form > .work-order-form-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "setup" "responsibility" "notes"; gap: 24px; }
    & .work-order-form-column-setup { grid-area: setup; }
    & .work-order-form-column-responsibility { grid-area: responsibility; }
    & .work-order-form-column-notes { grid-area: notes; }
    & .work-order-form-section-notes { grid-template-columns: minmax(0, 1fr); }
    & #work-order-form textarea { min-height: 100px; }
    & #work-order-form .form-actions { flex-wrap: nowrap; min-height: 64px; gap: 8px; padding-top: 10px !important; }
    & #work-order-form .form-actions button { flex: 1; padding-inline: 10px; }
    & #work-order-form .report-form-topline:has(.small-copy:empty) { display: none; }
  }
}
