/*! Hyper Man - stable app shell and responsive polish */
:root {
  --hm-app-height: 100dvh;
  --hm-safe-top: env(safe-area-inset-top, 0px);
  --hm-safe-right: env(safe-area-inset-right, 0px);
  --hm-safe-bottom: env(safe-area-inset-bottom, 0px);
  --hm-safe-left: env(safe-area-inset-left, 0px);
  --hm-touch-size: 42px;
  --hm-app-max: 1280px;
}

html {
  width: 100%;
  min-height: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  width: 100%;
  min-height: 100vh;
  min-height: var(--hm-app-height, 100dvh);
  overflow-x: clip !important;
  overscroll-behavior-x: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
img, svg, video, canvas, iframe { max-width: 100%; }
button, a, input, select, textarea { touch-action: manipulation; }
button, [role="button"], a { -webkit-tap-highlight-color: transparent; }
input, select, textarea { min-width: 0; max-width: 100%; }

.hm-main, .main, .main-content, .content, .page-content, .container { min-width: 0; }

.table-responsive, .table-wrap, .hm-table-wrap, .responsive-table {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay, .modal, .offcanvas, .contact-panel, .notif-panel { overscroll-behavior: contain; }
.hm-standalone body { min-height: var(--hm-app-height, 100dvh); }

@media (max-width: 768px) {
  :root {
    --hm-touch-size: 40px;
    --glass-blur: blur(14px);
  }
  html { scrollbar-gutter: auto; }
  body {
    font-size: clamp(12px, 3.25vw, 14px);
    background-attachment: scroll !important;
  }

  .hm-header, .top-bar, .topbar, .app-header, .page-header {
    padding-top: max(7px, var(--hm-safe-top)) !important;
  }

  .hm-bottom-nav, .bottom-nav, .pos-bottom-nav, .chat-bottomnav {
    padding-bottom: max(5px, var(--hm-safe-bottom)) !important;
  }

  .hm-bottom-nav > *, .bottom-nav > *, .pos-bottom-nav > *, .chat-bottomnav > * { min-width: 0; }

  button, .btn, .hm-btn, .hm-icon-btn, input, select { min-height: var(--hm-touch-size); }
  .hm-card, .card, .panel, .widget, .table-card { min-width: 0; }

  .modal-sheet, .modal-dialog, .modal-content {
    max-height: calc(var(--hm-app-height, 100dvh) - var(--hm-safe-top) - var(--hm-safe-bottom) - 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 360px) { :root { --hm-touch-size: 38px; } }

@media (hover: none), (pointer: coarse) {
  .hm-card:hover, .card:hover, .stat-card:hover { transform: none !important; }
}

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