/* SIMHSYCN Phase 10 — final responsive, accessibility and consistency pass */

/* Contain every application page inside the viewport. Wide tables keep their
   own scroll region instead of widening the whole document. */
body.simh-app,
body.simh-app .app-shell,
body.simh-app .app-main,
body.simh-app .content-area,
body.simh-app .page-title,
body.simh-app .native-hero,
body.simh-app .native-panel,
body.simh-app .card,
body.simh-app .panel,
body.simh-app .grid,
body.simh-app .stats {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

body.simh-app .app-shell,
body.simh-app .app-main,
body.simh-app .content-area {
  overflow-x: hidden !important;
}

body.simh-app .native-table-scroll,
body.simh-app .table-scroll,
body.simh-app .table-scroll-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

body.simh-app .native-table-scroll table,
body.simh-app .table-scroll table,
body.simh-app .table-scroll-wrapper table {
  margin: 0 !important;
}

/* Keep final pagination controls uniform on every list page. */
body.simh-app .pagination-toolbar {
  width: 100%;
  max-width: 100%;
  padding: 16px 0 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px !important;
}

body.simh-app .pagination-nav {
  min-width: 0;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  flex-wrap: wrap !important;
}

body.simh-app .pagination-nav > a,
body.simh-app .pagination-nav > span {
  min-width: 36px !important;
  min-height: 36px !important;
  padding: 7px 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--simh-border) !important;
  border-radius: 10px !important;
  color: var(--simh-text) !important;
  background: var(--simh-surface) !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
}

body.simh-app .pagination-nav > .active {
  border-color: transparent !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--simh-primary), var(--simh-accent)) !important;
  box-shadow: 0 7px 16px rgba(32, 101, 148, .18);
}

body.simh-app .pagination-nav > .disabled {
  opacity: .48 !important;
}

body.simh-app .pagination-nav > .pagination-ellipsis {
  min-width: 24px !important;
  border-color: transparent !important;
  background: transparent !important;
}

/* Form controls must not escape cards on narrow phones. */
body.simh-app input,
body.simh-app select,
body.simh-app textarea,
body.simh-app button,
body.simh-app .btn {
  max-width: 100%;
  box-sizing: border-box;
}

body.simh-app code,
body.simh-app pre,
body.simh-app .long-value,
body.simh-app .breakable {
  overflow-wrap: anywhere;
  word-break: break-word;
}

html[data-theme="dark"] body.simh-app .pagination-nav > a,
html[data-theme="dark"] body.simh-app .pagination-nav > span:not(.active) {
  border-color: var(--simh-border) !important;
  color: var(--simh-text) !important;
  background: var(--simh-surface) !important;
}

@media (max-width: 760px) {
  body.simh-app .pagination-toolbar {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  body.simh-app .pagination-nav {
    width: 100% !important;
    max-width: 100% !important;
    padding-bottom: 3px;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.simh-app .pagination-nav > a,
  body.simh-app .pagination-nav > span {
    flex: 0 0 auto;
  }

  body.simh-app .page-title h1,
  body.simh-app .native-hero h2,
  body.simh-app .section-head h2 {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 440px) {
  body.simh-app .content-area {
    width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body.simh-app .pagination-meta {
    font-size: 11px !important;
  }
}

/* List-page filter bars that do not have a page-specific grid use the same
   professional proportions as the admin transaction page. */
body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) {
  width: 100%;
  max-width: 100%;
  margin: 14px 0 0 !important;
  padding: 16px !important;
  display: flex !important;
  align-items: end !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  border: 1px solid var(--simh-border) !important;
  border-radius: 17px !important;
  background: var(--simh-surface-muted) !important;
}

body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > input {
  min-width: min(320px, 100%) !important;
  flex: 1 1 360px !important;
}

body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > select,
body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > label {
  min-width: 150px !important;
  flex: 0 1 190px !important;
}

body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > .btn,
body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > button,
body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > .wh-btn {
  min-height: 44px !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}

@media (max-width: 680px) {
  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) {
    padding: 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > input,
  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > select,
  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > label,
  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > .btn,
  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > button,
  body.simh-app form.search-row[data-compact-search="off"]:not(.native-search) > .wh-btn {
    width: 100% !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }
}
