/* Mainselfly Agenda — modal/safe-area consistency. */
.worker-agenda-dialog {
  gap: 0 !important;
  max-height: min(760px, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px)) !important;
}

.worker-agenda-dialog .agenda-dialog-scroll {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.worker-agenda-dialog .agenda-native-date,
.weekly-time-input {
  box-sizing: border-box !important;
  inline-size: 100% !important;
  width: 100% !important;
  min-inline-size: 0 !important;
  min-width: 0 !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  line-height: normal !important;
}

/* Keep the busy-only visibility capability in data/backend for future Agenda
   features, but do not expose the currently redundant control in the UI. */
.worker-agenda-dialog
  .agenda-dialog-scroll
  > .space-y-4
  > .flex.w-full.items-center.justify-between.gap-4.rounded-2xl.border {
  display: none !important;
}

/* Rule field suffixes (h / min) need to stay secondary but readable on mobile. */
main section:has(> h2) .relative > span.pointer-events-none {
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
}

/* Native iOS date/time controls otherwise sit slightly high inside the field.
   Keep both Agenda and recurring-week time values visually centred. */
@supports (-webkit-touch-callout: none) {
  .worker-agenda-dialog .agenda-native-date,
  .weekly-time-input {
    inline-size: -webkit-fill-available !important;
    width: -webkit-fill-available !important;
    max-inline-size: -webkit-fill-available !important;
    max-width: -webkit-fill-available !important;
  }

  .worker-agenda-dialog input[type="date"]::-webkit-date-and-time-value,
  .worker-agenda-dialog input[type="time"]::-webkit-date-and-time-value,
  .weekly-time-input::-webkit-date-and-time-value {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
  }

  .worker-agenda-dialog input[type="date"]::-webkit-datetime-edit,
  .worker-agenda-dialog input[type="time"]::-webkit-datetime-edit,
  .weekly-time-input::-webkit-datetime-edit {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
  }

  .worker-agenda-dialog input[type="date"]::-webkit-datetime-edit-fields-wrapper,
  .worker-agenda-dialog input[type="time"]::-webkit-datetime-edit-fields-wrapper,
  .weekly-time-input::-webkit-datetime-edit-fields-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Reuse the profile-editor keyboard architecture: modal fixed, footer above the
   iOS keyboard, only the inner body gains temporary scroll room. */
html[data-native-platform="ios"][data-native-keyboard-open="true"]
  .worker-agenda-dialog .agenda-dialog-footer {
  position: relative;
  z-index: 90;
  transform: translateY(var(--mainselfly-editor-keyboard-shift, 0px)) !important;
  transition: transform 180ms ease-out !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

html[data-native-platform="ios"][data-native-keyboard-open="true"]
  .worker-agenda-dialog .agenda-dialog-scroll {
  padding-bottom: var(--mainselfly-editor-scroll-reserve, 0px) !important;
}

html[data-native-platform="ios"][data-native-keyboard-open="true"]
  .worker-agenda-dialog input,
html[data-native-platform="ios"][data-native-keyboard-open="true"]
  .worker-agenda-dialog textarea,
html[data-native-platform="ios"][data-native-keyboard-open="true"]
  .worker-agenda-dialog select {
  scroll-margin-bottom: calc(var(--mainselfly-editor-keyboard-overlap, 0px) + 72px);
}
