/* ═══════════════════════════════════════════════════════════════════════════
   TopStars — iOS Safari (WebKit), Responsive & Multi-Language Engine
   Covers: Safe Areas, dvh/svh Viewports, Zero Auto-Zoom, WebKit Normalization,
           90+ Language Bottom Sheet & Desktop Filter, BiDi & Multi-Script Typography
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Safe Area Inset Custom Properties ────────────────────────────────── */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* ── 2. Viewport & Document Root Stabilization ──────────────────────────── */
html {
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip !important;
  max-width: 100vw;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip !important;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container,
.app-main,
.page-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── 3. iOS WebKit Touch & Interaction Normalization ─────────────────────── */
button,
a,
input,
select,
textarea,
[role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Remove default iOS rounded glossy bevels and inner shadows */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
  -webkit-appearance: none;
  appearance: none;
}

/* ── 4. Zero iOS Input Auto-Zoom on Focus ────────────────────────────────── */
/* Enforce minimum computed font-size of 16px on mobile viewports (< 768px) */
@media screen and (max-width: 767.98px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select,
  textarea,
  .form-control,
  .form-select,
  .ts-sheet-search-input,
  .ts-dd-search-input,
  .af-input,
  .cp-form-control {
    font-size: 16px !important;
  }
}

/* ── 5. Minimum 44x44px Touch Targets for iOS Accessibility ─────────────── */
.header-btn,
.ts-topup-btn,
.dash-menu-btn,
.navbar-toggler,
.modal-header .close,
.btn-close,
.ts-lang-sheet-close,
.ts-sheet-search-clear {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── 6. Header & Navigation Safe Area Architecture ───────────────────────── */
.app-header {
  padding-top: max(10px, env(safe-area-inset-top, 0px)) !important;
  padding-left: max(16px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(16px, env(safe-area-inset-right, 0px)) !important;
}

.heading {
  padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
  padding-left: max(16px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(16px, env(safe-area-inset-right, 0px)) !important;
}

.footer {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)) !important;
  padding-left: max(16px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(16px, env(safe-area-inset-right, 0px)) !important;
}

.app-sidebar {
  padding-top: max(12px, env(safe-area-inset-top, 0px)) !important;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)) !important;
  max-height: 100vh;
  max-height: 100dvh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── 7. Momentum Scrolling & Containment ─────────────────────────────────── */
.dropdown-content,
.modal,
.modal-dialog,
.modal-content,
.modal-body,
.table-responsive,
.ts-lang-sheet-body,
.ts-dd-langs-scroll {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.table-responsive {
  overscroll-behavior-x: contain;
  max-width: 100%;
}

/* Safe Area Insets for Modals & Checkout Sheets */
.modal.fade.in .modal-dialog,
.modal.show .modal-dialog {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

/* ── 8. Desktop 90+ Language Dropdown Enhancements ───────────────────────── */
.hdr-dd-wrap .dropdown-content.langs-btn-content {
  width: 290px !important;
  max-width: 320px !important;
  max-height: min(440px, 75vh) !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.ts-dd-search-box {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  background: #24252a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ts-dd-search-box i {
  color: #94a3b8;
  font-size: 15px;
  flex-shrink: 0;
}

.ts-dd-search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.ts-dd-search-input:focus {
  border-color: #f5c518;
  background: rgba(255, 255, 255, 0.09);
}

.ts-dd-langs-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px 0;
}

.ts-dd-lang-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 14px !important;
  color: #cbd5e1 !important;
  text-decoration: none !important;
  font-size: 13.5px !important;
  transition: background-color 0.12s, color 0.12s;
}

.ts-dd-lang-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.ts-dd-lang-item.active {
  background: rgba(245, 197, 24, 0.12) !important;
  color: #f5c518 !important;
  font-weight: 600 !important;
}

.ts-dd-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-right: 8px;
  flex-shrink: 0;
}

[dir="rtl"] .ts-dd-code {
  margin-right: 0;
  margin-left: 8px;
}

.ts-dd-name {
  flex: 1;
  text-align: left;
}

[dir="rtl"] .ts-dd-name {
  text-align: right;
}

.ts-dd-check {
  color: #f5c518;
  font-size: 15px;
  margin-left: 8px;
}

[dir="rtl"] .ts-dd-check {
  margin-left: 0;
  margin-right: 8px;
}

/* ── 9. Mobile 90+ Language Selector Bottom Sheet Modal ─────────────────── */
.ts-lang-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(10, 11, 15, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.26s ease, visibility 0.26s;
  touch-action: none;
}

.ts-lang-sheet-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.ts-lang-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-height: min(84dvh, 620px);
  max-height: min(84vh, 620px);
  background: #1a1b20;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.65);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.ts-lang-sheet.is-open {
  transform: translateY(0);
  visibility: visible;
}

.ts-lang-sheet-handle-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 10px;
  padding-bottom: 4px;
  cursor: grab;
}

.ts-lang-sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.ts-lang-sheet-header {
  padding: 8px 18px 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ts-lang-sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ts-lang-sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ts-lang-sheet-globe {
  color: #f5c518;
  font-size: 22px;
  flex-shrink: 0;
}

.ts-lang-sheet-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
}

.ts-lang-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(245, 197, 24, 0.15);
  color: #f5c518;
  border-radius: 999px;
  border: 1px solid rgba(245, 197, 24, 0.3);
}

.ts-lang-sheet-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: #cbd5e1;
  font-size: 20px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, color 0.15s;
}

.ts-lang-sheet-close:active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.ts-lang-sheet-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ts-sheet-search-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

[dir="rtl"] .ts-sheet-search-icon {
  left: auto;
  right: 14px;
}

.ts-sheet-search-input {
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0 42px 0 42px;
  color: #fff;
  font-size: 16px !important;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.ts-sheet-search-input:focus {
  border-color: #f5c518;
  background: rgba(255, 255, 255, 0.09);
}

.ts-sheet-search-clear {
  position: absolute;
  right: 4px;
  background: transparent;
  border: none;
  width: 44px;
  height: 44px;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
}

[dir="rtl"] .ts-sheet-search-clear {
  right: auto;
  left: 4px;
}

.ts-lang-sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px 24px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

@media screen and (max-width: 380px) {
  .ts-lang-sheet-body {
    grid-template-columns: 1fr;
  }
}

.ts-sheet-lang-item {
  min-height: 48px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #cbd5e1;
  text-decoration: none !important;
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
  -webkit-user-select: none;
  user-select: none;
}

.ts-sheet-lang-item:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.98);
}

.ts-sheet-lang-item.is-active {
  background: rgba(245, 197, 24, 0.14);
  border-color: rgba(245, 197, 24, 0.45);
  color: #f5c518;
  font-weight: 600;
}

.ts-sheet-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #94a3b8;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.ts-sheet-lang-item.is-active .ts-sheet-code {
  background: rgba(245, 197, 24, 0.25);
  color: #f5c518;
}

.ts-sheet-name {
  flex: 1;
  font-size: 13.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-sheet-check {
  color: #f5c518;
  font-size: 16px;
  margin-left: auto;
  flex-shrink: 0;
}

[dir="rtl"] .ts-sheet-check {
  margin-left: 0;
  margin-right: auto;
}

.ts-sheet-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: #94a3b8;
  text-align: center;
  gap: 10px;
}

.ts-sheet-empty i {
  font-size: 32px;
  color: #64748b;
}

.ts-sheet-empty p {
  margin: 0;
  font-size: 14px;
}

/* ── 10. Multi-Script Typography Resilience ──────────────────────────────── */
/* Compound words resilience for long script languages */
:lang(de), :lang(ru), :lang(fi), :lang(sv), :lang(no), :lang(da), :lang(et), :lang(hu) {
  hyphens: auto;
  overflow-wrap: anywhere;
}

/* CJK script line break precision */
:lang(zh), :lang(ja), :lang(ko) {
  word-break: keep-all;
  line-break: strict;
}

/* Tall scripts resilience (Arabic, Urdu, Persian, Hindi, Thai) */
html[dir="rtl"], :lang(ar), :lang(ur), :lang(fa), :lang(ps), :lang(hi), :lang(bn), :lang(th) {
  line-height: 1.55;
}

/* BiDi Isolation Utility */
.ts-bidi-ltr {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-block;
  text-align: left;
}

html[dir="rtl"] .ts-bidi-ltr {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  text-align: left !important;
}

/* Directional Icon Mirroring in RTL */
html[dir="rtl"] .ri-arrow-right-line,
html[dir="rtl"] .ri-arrow-right-s-line,
html[dir="rtl"] .ri-arrow-right-fill,
html[dir="rtl"] .ri-arrow-right-s-fill,
html[dir="rtl"] .fa-arrow-right,
html[dir="rtl"] .fa-chevron-right {
  transform: scaleX(-1) !important;
}

html[dir="rtl"] .ri-arrow-left-line,
html[dir="rtl"] .ri-arrow-left-s-line,
html[dir="rtl"] .ri-arrow-left-fill,
html[dir="rtl"] .ri-arrow-left-s-fill,
html[dir="rtl"] .fa-arrow-left,
html[dir="rtl"] .fa-chevron-left {
  transform: scaleX(-1) !important;
}

/* ==========================================================================
   PHASE 2: .smm-annc-inner ALL-PHONES UPGRADE & GUEST / USER / ADMIN MOBILE
   ========================================================================== */

:root {
  --ts-annc-height: 0px;
  --ts-annc-bg: linear-gradient(90deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --ts-annc-border: rgba(255, 255, 255, 0.12);
  --ts-annc-text: #f8fafc;
  --ts-annc-accent: #38bdf8;
  --ts-annc-badge-bg: rgba(56, 189, 248, 0.16);
}

/* --------------------------------------------------------------------------
   1. UPGRADED .smm-annc & .smm-annc-inner FOR ALL PHONES (iOS & Android)
   -------------------------------------------------------------------------- */
.smm-annc {
  position: relative;
  z-index: 1035;
  inline-size: 100%;
  background: var(--ts-annc-bg);
  color: var(--ts-annc-text);
  border-block-end: 1px solid var(--ts-annc-border);
  padding-block-start: var(--sat, env(safe-area-inset-top, 0px));
  padding-inline-start: max(0.75rem, var(--sal, env(safe-area-inset-left, 0px)));
  padding-inline-end: max(0.75rem, var(--sar, env(safe-area-inset-right, 0px)));
  box-sizing: border-box;
  overflow: hidden;
}

.smm-annc[hidden],
.smm-annc.is-dismissed {
  display: none !important;
}

.smm-annc-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.625rem;
  max-inline-size: 1320px;
  min-block-size: 2.75rem;
  block-size: auto !important; /* Overrides legacy fixed 36px/40px height */
  margin-inline: auto;
  padding-block: 0.45rem;
  box-sizing: border-box;
}

/* Start Slot: Pulse + Badge/Icon */
.smm-annc-lead {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  align-self: center;
}

.smm-annc-pulse {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 999px;
  background-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  flex-shrink: 0;
}

.smm-annc-badge {
  display: inline-flex;
  align-items: center;
  padding-block: 0.15rem;
  padding-inline: 0.5rem;
  border-radius: 999px;
  background: var(--ts-annc-badge-bg);
  color: var(--ts-annc-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.smm-annc-icon {
  font-size: 1.05rem;
  color: var(--ts-annc-accent);
  line-height: 1;
}

/* Center Slot: Announcement Message + CTA */
.smm-annc-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 0.625rem;
  row-gap: 0.25rem;
  min-inline-size: 0;
  text-align: start;
}

.smm-annc-text,
.smm-annc-inner > p,
.smm-annc-inner > span:not(.smm-annc-badge):not(.smm-annc-pulse) {
  margin: 0;
  min-inline-size: 0;
  font-size: clamp(0.78rem, 2.6vw, 0.875rem);
  line-height: 1.45;
  color: var(--ts-annc-text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Compact 2-line clamp on phones with tap-to-expand support */
@media screen and (max-width: 767.98px) {
  .smm-annc-body {
    justify-content: flex-start;
  }

  .smm-annc:not(.is-expanded) .smm-annc-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    cursor: pointer;
  }
}

/* Tall script line-height inside .smm-annc-inner (Arabic, Urdu, Farsi, Hindi, Thai) */
:lang(ar) .smm-annc-text,
:lang(ur) .smm-annc-text,
:lang(fa) .smm-annc-text,
:lang(hi) .smm-annc-text,
:lang(th) .smm-annc-text {
  line-height: 1.6;
}

/* Inline CTA Pill inside .smm-annc-inner */
.smm-annc-cta,
.smm-annc-inner a:not(.btn-close) {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding-block: 0.15rem;
  padding-inline: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.smm-annc-cta:hover,
.smm-annc-inner a:hover {
  background: rgba(255, 255, 255, 0.22);
}

[dir="rtl"] .smm-annc-cta .ri-arrow-right-line,
[dir="rtl"] .smm-annc-cta .ri-arrow-right-s-line,
[dir="rtl"] .smm-annc-inner .fa-arrow-right {
  transform: scaleX(-1);
}

/* End Slot: 44x44px Accessible Dismiss Button */
.smm-annc-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  margin-block: -0.35rem;
  margin-inline-end: -0.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(248, 250, 252, 0.75);
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.smm-annc-close:hover,
.smm-annc-close:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

/* Ultra-narrow phones (iPhone SE / Galaxy Fold cover: <= 359px) */
@media screen and (max-width: 359.98px) {
  .smm-annc-inner {
    column-gap: 0.45rem;
    padding-block: 0.4rem;
  }
  .smm-annc-badge {
    display: none; /* Keep pulse dot + message + close button clean on 320px */
  }
}

/* --------------------------------------------------------------------------
   2. GUEST MOBILE EXPERIENCE (/auth, Public Navbar, Hero & Services)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 991.98px) {
  /* Prevent Guest Navbar Logo + Language Trigger + Auth CTAs from overflowing */
  .guest-navbar .container,
  .navbar-guest .container,
  header .navbar-container,
  .heading .navbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-inline-size: 0;
  }

  .navbar-brand {
    max-inline-size: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
  }

  /* Auth Card Dynamic Viewport Fit below .smm-annc */
  .auth-wrapper,
  .login-page,
  .guest-auth-section,
  .login-wrapper,
  .signup-outer {
    min-block-size: calc(100dvh - var(--ts-annc-height, var(--annc-h, 0px)));
    padding-block: 1.25rem calc(1.5rem + var(--sab, 0px));
    padding-inline: max(0.875rem, var(--sal, 0px)) max(0.875rem, var(--sar, 0px));
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   3. AUTHENTICATED USER MOBILE EXPERIENCE (Dashboard, Orders, OTP, Wallet)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 991.98px) {
  /* User Topbar Compact Alignment */
  .user-header,
  .dashboard-topbar,
  .app-header {
    padding-inline-start: max(0.75rem, var(--sal, 0px));
    padding-inline-end: max(0.75rem, var(--sar, 0px));
    gap: 0.5rem;
  }

  /* Keep Service Picker Dropdowns & Category Selects within Mobile Screen */
  select#orderform-service,
  select#orderform-category,
  .service-select-dropdown,
  .select2-container {
    max-inline-size: 100% !important;
    inline-size: 100% !important;
  }

  .select2-selection__rendered {
    white-space: normal !important;
    line-height: 1.35 !important;
    padding-block: 0.35rem !important;
  }

  /* Mobile Sidebar Drawer Safe Area & Scroll Containment */
  .sidebar-mobile,
  .app-sidebar,
  .offcanvas-sidebar {
    max-block-size: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-block-end: calc(1.25rem + var(--sab, 0px));
  }
}

/* --------------------------------------------------------------------------
   4. ADMIN / STAFF PANEL MOBILE EXPERIENCE (Tables, Filters & Bulk Bars)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 991.98px) {
  /* Override desktop-only min-width locks in Admin views */
  body.admin-body,
  .admin-wrapper,
  .admin-container,
  .admin-main,
  .admin-content,
  body.admin {
    min-inline-size: 0 !important;
    inline-size: 100% !important;
    max-inline-size: 100vw !important;
    overflow-x: clip;
  }

  /* Stack Admin Filter Bars & Search Controls cleanly on Phones */
  .admin-filter-bar,
  .admin-toolbar,
  .admin-search-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.625rem !important;
  }

  .admin-filter-bar > *,
  .admin-toolbar .form-control,
  .admin-toolbar .form-select,
  .admin-toolbar .btn {
    inline-size: 100% !important;
    min-block-size: 44px;
    font-size: 16px !important;
  }

  /* Admin Tables: Smooth Momentum Horizontal Scroll + Unclipped Action Menus */
  .admin-table-wrap,
  .admin-content .table-responsive {
    display: block;
    inline-size: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-block-end: 3.5rem; /* Space for row action dropdowns */
  }

  /* Sticky Bottom Bulk-Action Toolbar for Admin Multi-Select on Phones */
  .admin-bulk-actions,
  .bulk-action-bar {
    position: fixed !important;
    inset-block-end: 0 !important;
    inset-inline-start: 0 !important;
    inset-inline-end: 0 !important;
    z-index: 1050;
    padding-block: 0.75rem calc(0.75rem + var(--sab, 0px)) !important;
    padding-inline: max(1rem, var(--sal, 0px)) max(1rem, var(--sar, 0px)) !important;
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
  }
}

