/* Belenenses SUB-19 — shared, low-specificity UI foundation.
   Module styles remain responsible for the product's visual identity. */
:where(*, *::before, *::after) { box-sizing: border-box; }

:where(html) {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

:where(body) {
  margin: 0;
  min-width: 0;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

:where(button, input, select, textarea) { font: inherit; }
:where(button, [role="button"], a, label, select) { -webkit-tap-highlight-color: transparent; }
:where(button:not(:disabled), [role="button"]:not([aria-disabled="true"]), a[href], label[for], select) { cursor: pointer; }
:where(img, svg, video, canvas) { display: block; max-width: 100%; }
:where([hidden]) { display: none !important; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #71e5ff;
  outline-offset: 3px;
}

:where(input, select, textarea) {
  max-width: 100%;
}

:where(textarea) { resize: vertical; }

:where(dialog, [role="dialog"], .modal, .sheet) {
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
}

:where(.modal-body, .sheet-body, [data-scroll-region]) {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

:where(.table-wrap, .table-scroll, [data-table-scroll]) {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

@media (pointer: coarse) {
  :where(button, [role="button"], input:not([type="checkbox"]):not([type="radio"]), select) {
    min-height: 44px;
  }
}

@media (max-width: 760px) {
  :where(input, select, textarea) { font-size: max(16px, 1em); }
  :where(dialog, [role="dialog"], .modal, .sheet) {
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(html) { scroll-behavior: auto; }
  :where(*, *::before, *::after) {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline-color: Highlight;
  }
}
