/* Shared screen sizing. Native date editors must fit their grid cell on iOS. */
@media screen {
  :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    box-sizing: border-box;
    min-width: 0;
    min-inline-size: 0;
    max-width: 100%;
    max-inline-size: 100%;
  }

  :where(.fields, .pwl-fields, .jkp-filters) > * {
    min-width: 0;
    min-inline-size: 0;
  }

  .fields > label,
  label.pwl-field {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
  }

  :where(.fields, .pwl-fields) :is(input:not([type="checkbox"]):not([type="radio"]), select) {
    width: 100%;
    inline-size: 100%;
    height: 44px;
    block-size: 44px;
    min-height: 44px;
    flex: 0 0 44px;
  }

  :where(.reports-page, .report-dialog) :is(input:not([type="checkbox"]):not([type="radio"]), select) {
    height: 44px;
    block-size: 44px;
    min-height: 44px;
  }

  .reports-page input[type="file"],
  .report-dialog input[type="file"] {
    padding-block: 8px;
  }

  input:is([type="date"], [type="datetime-local"], [type="time"]) {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    inline-size: 100%;
    height: 44px;
    block-size: 44px;
    min-width: 0;
    min-inline-size: 0;
    max-width: 100%;
    max-inline-size: 100%;
    text-align: start;
    overflow: hidden;
  }

  input:is([type="date"], [type="datetime-local"], [type="time"])::-webkit-date-and-time-value {
    min-width: 0;
    min-inline-size: 0;
    max-width: 100%;
    min-height: 1.3em;
    text-align: start;
  }

  input:is([type="date"], [type="datetime-local"], [type="time"])::-webkit-datetime-edit {
    padding: 0;
    min-width: 0;
    min-inline-size: 0;
  }

  .worklist-page .worker-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 6px;
    align-items: stretch;
  }

  .worklist-page .worker-row :is(input, button),
  .pwl-worker-row :is(input, button) {
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    margin: 0;
  }

  .worklist-page nav {
    align-items: stretch;
  }

  .worklist-page nav a {
    display: flex;
    align-items: center;
  }

  .worklist-page nav button,
  .worklist-page #add-worker {
    min-height: 44px;
  }
}

@media screen and (max-width: 760px), screen and (hover: none) and (pointer: coarse) {
  :where(.fields, .pwl-fields, .worklist-page, .report-dialog, .reports-page) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    font-size: 16px;
  }
}

@media screen and (max-width: 380px) {
  .map-page > header {
    gap: 8px;
  }

  .map-page .jkp-header-link {
    margin-left: 0;
  }

  .fields,
  .pwl-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .fields > .wide,
  .pwl-fields > .pwl-wide {
    grid-column: 1 / -1;
  }
}
