/* System-wide readability floor. Loaded after the app's existing styles. */
body {
  font-size: 17px !important;
  line-height: 1.55;
}

:is(
  button,
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea,
  a.button,
  a.btn,
  a[role="button"]
) {
  min-height: 40px;
  font-size: 16px !important;
}

:is(label, legend) {
  font-size: 15px !important;
}

:is(small, .muted, .helper, .help, .hint, [class$="-helper"], [class$="-help"], [class$="-hint"]) {
  font-size: 14px !important;
  line-height: 1.55;
}

:is(table, td) {
  font-size: 15px !important;
}

th {
  font-size: 14px !important;
}

:is(
  .badge,
  .pill,
  .chip,
  .tag,
  [class$="-badge"],
  [class$="-pill"],
  [class$="-chip"],
  [class$="-tag"]
) {
  font-size: 13px !important;
}

/* Mobile-only layout overlay. */
@media (max-width: 760px) {
  :is(html, body, .app-shell, .panel, .auth-shell, .auth-card) {
    max-width: 100%;
    min-width: 0;
  }

  :is(img, video, canvas, iframe) {
    max-width: 100%;
    height: auto;
  }

  :is(
    button,
    [role="button"],
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea,
    a.button,
    a.btn,
    .top-actions a
  ) {
    min-height: 44px;
    min-width: 44px;
  }

  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
    font-size: 16px;
  }

  :is(
    .topbar,
    .top-actions,
    .panel-heading,
    .history-heading,
    .item-actions,
    .salary-settings-footer,
    .legacy-pay-heading,
    .legacy-pay-footer
  ) {
    max-width: 100%;
    align-items: flex-start;
    flex-wrap: wrap !important;
  }

  :is(
    .staff-grid,
    .summary-grid,
    .form-row,
    .form-row.three,
    .admin-controls,
    .admin-request,
    .salary-rate-list,
    .legacy-pay-fields,
    .legacy-evidence-grid
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  :is(.employee-summary-table-wrap, .table-wrap, .table-container, .table-scroll) {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  :is(.modal-bg, .modal-backdrop, .dialog-backdrop) {
    padding-top: max(12px, env(safe-area-inset-top)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    padding-left: max(12px, env(safe-area-inset-left)) !important;
  }

  :is(dialog, .modal, .dialog, [role="dialog"]) {
    width: min(100%, calc(100vw - 24px)) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow: auto;
  }
}

@media (max-width: 420px) {
  :is(.top-actions, .item-actions, .review-actions) > :is(button, a) {
    flex: 1 1 100%;
  }
}

/* Selector-specific readability floors. Keep this final for cascade priority. */
.eyebrow {
  font-size: 14px !important;
}

:is(
  .review-result p,
  .legacy-pay-heading p,
  .legacy-evidence-grid span,
  .salary-rate-item,
  .hero-clock span,
  .summary-grid article span,
  .panel-heading p,
  .form-error,
  .employee-summary-table td::before,
  footer
) {
  font-size: 14px !important;
  line-height: 1.55;
}

.top-actions a {
  font-size: 16px !important;
}

:is(
  .legacy-pay-heading > span,
  .employee-summary-status,
  .pay-readiness,
  .top-actions b,
  .status
) {
  font-size: 13px !important;
}
