:root {
  --native-touch-target: 46px;
  --native-radius: 18px;
  --native-safe-bottom: env(safe-area-inset-bottom, 0px);
  --native-safe-top: env(safe-area-inset-top, 0px);
}

html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body { overscroll-behavior-y: none; }

@media (max-width: 768px) {
  html, body {
    min-height: 100%;
    background: radial-gradient(circle at 18% 12%, rgba(0, 180, 216, 0.16), transparent 34%), linear-gradient(145deg, #eef5ff 0%, #f8fbff 100%);
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image: linear-gradient(135deg, transparent 44%, rgba(20, 29, 38, 0.08) 45%, rgba(20, 29, 38, 0.08) 55%, transparent 56%), repeating-linear-gradient(0deg, rgba(20,29,38,0.055) 0 1px, transparent 1px 9px);
    background-repeat: no-repeat;
    background-position: center 32%;
    background-size: min(78vw, 360px);
    opacity: 0.055;
    animation: mobile-watermark-breathe 8s ease-in-out infinite;
  }

  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.74));
  }

  @keyframes mobile-watermark-breathe {
    0%, 100% { opacity: 0.04; transform: scale(0.98); }
    50% { opacity: 0.08; transform: scale(1.03); }
  }

  .page, .layout, .app-shell, main, .main, .content, article {
    max-width: 100%;
    overflow-x: hidden;
  }

  .content, article.content, .container, .container-fluid, .main-content {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .card, .panel, .glass, .surface, .login-card, .dashboard-card, .summary-card, section, form {
    border-radius: var(--native-radius) !important;
  }

  .glass, .card, .panel, .surface, .login-card, .dashboard-card, .summary-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.8), rgba(255,255,255,0.52)) !important;
    border: 1px solid rgba(255,255,255,0.64) !important;
    box-shadow: 0 18px 45px rgba(13, 27, 62, 0.13), inset 0 1px 0 rgba(255,255,255,0.75) !important;
    backdrop-filter: blur(22px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.2) !important;
  }

  h1, .page-title { font-size: clamp(1.55rem, 8vw, 2.2rem) !important; line-height: 1.06; letter-spacing: 0; }
  h2, h3 { letter-spacing: 0; }
  p, label, small, span, td, th { overflow-wrap: anywhere; }

  button, .btn, a.btn, input, select, textarea, .form-control, .form-select, .nav-link {
    min-height: var(--native-touch-target);
    touch-action: manipulation;
  }

  .btn, button { border-radius: 999px; }

  .form-control, .form-select, textarea {
    border-radius: 14px !important;
    background: rgba(255,255,255,0.8) !important;
    border-color: rgba(13, 27, 62, 0.14) !important;
    font-size: 16px;
  }

  .row, .grid, .dashboard-grid, .cards-grid, .summary-grid {
    gap: 0.85rem;
  }

  .mobile-section-swipe, .cards-carousel, .dashboard-grid, .summary-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(84%, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 0.85rem;
  }

  .mobile-section-swipe > *, .cards-carousel > *, .dashboard-grid > *, .summary-grid > * {
    scroll-snap-align: center;
    min-width: 0;
  }

  .mobile-section-swipe::-webkit-scrollbar, .cards-carousel::-webkit-scrollbar, .dashboard-grid::-webkit-scrollbar, .summary-grid::-webkit-scrollbar {
    display: none;
  }

  .table-responsive, table {
    max-width: 100%;
  }

  .table-responsive {
    border-radius: var(--native-radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 768px) {
  body::before,
  body::after {
    content: none !important;
  }

  .login-screen,
  .login-card {
    position: relative;
    overflow: hidden;
  }

  .login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: linear-gradient(135deg, transparent 44%, rgba(20, 29, 38, 0.11) 45%, rgba(20, 29, 38, 0.11) 55%, transparent 56%), repeating-linear-gradient(0deg, rgba(20,29,38,0.07) 0 1px, transparent 1px 9px);
    background-repeat: no-repeat;
    background-position: center;
    background-size: min(82vw, 360px);
    opacity: 0.12;
    animation: mobile-watermark-breathe 8s ease-in-out infinite;
  }

  .login-card > * {
    position: relative;
    z-index: 1;
  }

  .shell-header,
  .public-shell-header,
  .shell-mobile-bottom-nav {
    z-index: 30000 !important;
  }

  .shell-menu-backdrop.open {
    z-index: 30010 !important;
  }

  .shell-header-panel,
  .shell-header-panel.open,
  .shell-nav-dropdown,
  .shell-config-menu,
  .shell-logout-menu,
  .shell-welcome-menu {
    z-index: 30020 !important;
  }

  .shell-nav-dropdown-menu,
  .shell-nav-dropdown-menu.open {
    z-index: 30030 !important;
    pointer-events: auto !important;
  }
}

/* Native mobile full-screen navigation surfaces */
@media (max-width: 768px) {
  .shell-menu-backdrop.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 39980 !important;
    background: rgba(20, 29, 38, 0.42) !important;
    backdrop-filter: blur(10px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.05) !important;
  }

  .shell-header-panel.open,
  .shell-nav-dropdown-menu.open,
  .shell-config-menu.open,
  .shell-logout-menu.open,
  .shell-welcome-menu .shell-nav-dropdown-menu.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 40000 !important;
    width: 100vw !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 22px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    background: linear-gradient(145deg, rgba(255, 255, 252, 0.96), rgba(238, 231, 218, 0.9)) !important;
    box-shadow: none !important;
    backdrop-filter: blur(26px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(26px) saturate(1.12) !important;
  }

  .shell-mobile-submenu-head,
  .shell-welcome-menu-header {
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: 56px;
    padding: 6px 0 12px !important;
    background: inherit;
  }

  .shell-mobile-submenu-back,
  .shell-menu-toggle,
  .shell-alert-bell,
  .shell-nav-link,
  .shell-nav-dropdown-toggle,
  .shell-nav-dropdown-link,
  .shell-logout-option {
    min-height: 48px !important;
    touch-action: manipulation;
  }

  .shell-header-panel.open .shell-nav,
  .shell-nav-dropdown-menu.open {
    gap: 10px !important;
  }

  .shell-header-panel.open .shell-nav-link,
  .shell-nav-dropdown-menu.open .shell-nav-link {
    width: 100% !important;
    justify-content: flex-start !important;
    border-radius: 16px !important;
    padding: 13px 14px !important;
    font-size: 0.96rem !important;
    line-height: 1.15 !important;
  }
}
/* Final native mobile menu/flyout positioning pass */
@media (max-width: 768px) {
  .shell-menu-backdrop.open {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
  }

  .shell-header-panel,
  .shell-nav-dropdown-menu,
  .shell-config-menu,
  .shell-logout-menu,
  .shell-welcome-menu .shell-nav-dropdown-menu {
    transform: translateX(100%) !important;
    transition: transform 220ms ease, opacity 180ms ease !important;
  }

  .shell-header-panel.open,
  .shell-nav-dropdown-menu.open,
  .shell-config-menu.open,
  .shell-logout-menu.open,
  .shell-welcome-menu .shell-nav-dropdown-menu.open {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    transform: translateX(0) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
  }

  .shell-header-panel.open {
    overflow: hidden !important;
  }

  .shell-header-panel.open .shell-nav,
  .shell-nav-dropdown-menu.open {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  [class*="flyout"].open,
  [class*="drawer"].open {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    transform: translateX(0) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
  }
}

/* Hard stop: Capitol mobile shell menus are native full-screen surfaces. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1180px) {
  body:has(.shell-header-panel.open),
  body:has(.shell-nav-dropdown-menu.open),
  body:has(.shell-config-menu.open),
  body:has(.shell-logout-menu.open) {
    overflow: hidden !important;
  }

  .shell-menu-backdrop.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147482998 !important;
  }

  .shell-header-panel.open,
  .shell-nav-dropdown-menu.open,
  .shell-config-menu.open,
  .shell-logout-menu.open,
  .shell-welcome-menu .shell-nav-dropdown-menu.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    transform: translateX(0) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 22px) !important;
  }
}

/* Structural mobile shell fix: every opened Capitol menu is a top-level app sheet. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1180px) {
  .shell-header-panel.open,
  .shell-header-panel.mobile-section-open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483200 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px calc(env(safe-area-inset-bottom, 0px) + 16px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    background: linear-gradient(145deg, rgba(255, 255, 252, 0.98), rgba(238, 231, 218, 0.94)) !important;
    backdrop-filter: blur(28px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.14) !important;
  }

  .shell-header-panel.open .shell-mobile-app-sheet,
  .shell-header-panel.mobile-section-open .shell-mobile-app-sheet {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .shell-header-panel.open .shell-mobile-app-group,
  .shell-header-panel.mobile-section-open .shell-mobile-app-group,
  .shell-header-panel.open .shell-mobile-account-card,
  .shell-header-panel.mobile-section-open .shell-mobile-account-card {
    border-radius: 16px !important;
  }

  .shell-header-panel.open .shell-mobile-app-group.is-open,
  .shell-header-panel.mobile-section-open .shell-mobile-app-group.is-open {
    position: static !important;
    inset: auto !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .shell-header-panel.open .shell-mobile-app-group.is-open > .shell-mobile-app-links,
  .shell-header-panel.mobile-section-open .shell-mobile-app-group.is-open > .shell-mobile-app-links {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .shell-header-panel.open .shell-mobile-app-link,
  .shell-header-panel.mobile-section-open .shell-mobile-app-link,
  .shell-header-panel.open .shell-mobile-account-link,
  .shell-header-panel.mobile-section-open .shell-mobile-account-link,
  .shell-header-panel.open .shell-mobile-app-group-title,
  .shell-header-panel.mobile-section-open .shell-mobile-app-group-title {
    min-height: 56px !important;
    font-size: 1rem !important;
    touch-action: manipulation !important;
  }
}

/* Banking/Core Admin parity: Capitol mobile menus are full-screen app sheets. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1180px) {
  body:has(.shell-header-panel.open),
  body:has(.shell-header-panel.mobile-section-open) {
    overflow: hidden !important;
  }

  .shell-menu-backdrop.open {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483100 !important;
    background: rgba(24, 25, 22, 0.42) !important;
    backdrop-filter: blur(10px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.05) !important;
  }

  .shell-header-panel,
  .shell-header-panel.open,
  .shell-header-panel.mobile-section-open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483200 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: linear-gradient(145deg, rgba(255, 255, 252, 0.97), rgba(238, 231, 218, 0.94)) !important;
    box-shadow: none !important;
    backdrop-filter: blur(28px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.14) !important;
    transform: translateX(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 220ms ease, opacity 180ms ease !important;
  }

  .shell-header-panel.open,
  .shell-header-panel.mobile-section-open {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .shell-header-panel.open .shell-desktop-menu,
  .shell-header-panel.mobile-section-open .shell-desktop-menu,
  .shell-header-panel.open .shell-nav,
  .shell-header-panel.mobile-section-open .shell-nav {
    display: none !important;
  }

  .shell-header-panel.open .shell-mobile-app-sheet,
  .shell-header-panel.mobile-section-open .shell-mobile-app-sheet {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-account-card,
  .shell-header-panel.mobile-subsection-open .shell-mobile-logout-group,
  .shell-header-panel.mobile-subsection-open .shell-mobile-app-group:not(.is-open) {
    display: none !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-app-group.is-open {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-app-group.is-open > .shell-mobile-app-links {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .shell-mobile-app-group,
  .shell-mobile-account-card,
  .shell-mobile-logout-group {
    border-radius: 16px !important;
  }

  .shell-mobile-app-link,
  .shell-mobile-account-link,
  .shell-mobile-app-group-title,
  .shell-mobile-logout-button {
    min-height: 56px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px !important;
    border-radius: 16px !important;
    font-size: 1rem !important;
    line-height: 1.15 !important;
    touch-action: manipulation !important;
  }

  .shell-mobile-submenu-head {
    position: sticky !important;
    top: 0 !important;
    z-index: 1 !important;
    flex: 0 0 auto !important;
    min-height: 56px !important;
    padding: 0 0 12px !important;
    background: inherit !important;
  }
}

/* Final correction: Capitol mobile menu consumes the whole viewport and closes by swipe. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1180px) {
  html:has(.shell-header-panel.open),
  body:has(.shell-header-panel.open),
  html:has(.shell-header-panel.mobile-section-open),
  body:has(.shell-header-panel.mobile-section-open) {
    width: 100vw !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }

  .shell-header-panel.open,
  .shell-header-panel.mobile-section-open {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
  }

  .shell-header-panel.open .shell-mobile-app-sheet,
  .shell-header-panel.mobile-section-open .shell-mobile-app-sheet,
  .shell-header-panel.open .shell-mobile-app-sections,
  .shell-header-panel.mobile-section-open .shell-mobile-app-sections {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .shell-mobile-sheet-handle {
    flex: 0 0 auto !important;
    min-height: 22px !important;
    cursor: grab !important;
    touch-action: pan-y !important;
  }
}

/* Final native mobile drawer/flyout behavior pass. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1180px) {
  .shell:has(.shell-header-panel.open),
  .shell:has(.shell-header-panel.mobile-section-open),
  .shell-header,
  .shell-header-inner,
  .shell-header-bar {
    overflow: visible !important;
    transform: none !important;
    contain: none !important;
  }

  .shell-header-panel.open,
  .shell-header-panel.mobile-section-open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483600 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    transform: none !important;
    translate: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .shell-header-panel.open .shell-mobile-app-sheet,
  .shell-header-panel.mobile-section-open .shell-mobile-app-sheet {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483601 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px calc(env(safe-area-inset-bottom, 0px) + 18px) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: linear-gradient(145deg, rgba(255, 255, 252, 0.98), rgba(237, 231, 218, 0.96)) !important;
    backdrop-filter: blur(30px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(30px) saturate(1.14) !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-app-sheet {
    overflow: hidden !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-app-group.is-open {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-app-group.is-open > .shell-mobile-app-group-title {
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    flex: 0 0 auto !important;
    min-height: 58px !important;
    margin: 0 0 10px !important;
    background: linear-gradient(135deg, rgba(23, 50, 82, 0.96), rgba(49, 86, 130, 0.9)) !important;
    color: #fff !important;
    box-shadow: 0 14px 28px rgba(20, 28, 40, 0.18) !important;
  }

  .shell-header-panel.mobile-subsection-open .shell-mobile-app-group.is-open > .shell-mobile-app-links {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .trade-flyout-close,
  .market-ticker-live__flyout-close,
  .notification-close,
  .shell-mobile-menu-close,
  .news-story-drawer__close {
    display: none !important;
  }

  .trade-flyout-panel,
  .market-ticker-live__flyout,
  .news-story-drawer,
  .notification-panel {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 56px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - 56px) !important;
    max-height: none !important;
    border-radius: 20px 20px 0 0 !important;
    transform: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
  }

  .trade-flyout-header,
  .market-ticker-live__flyout-topbar,
  .news-story-drawer__header,
  .notification-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 3 !important;
  }
}

/* Hard stop: mobile flyouts are viewport dialogs, visible immediately. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1180px) {
  body:has(.trade-flyout-panel),
  body:has(.market-ticker-live__flyout),
  body:has(.news-story-drawer),
  body:has(.notification-panel),
  body:has(.alert-inbox-panel),
  body:has(.research-agent-panel) {
    overflow: hidden !important;
  }

  .trade-flyout-backdrop,
  .market-ticker-live__flyout-backdrop,
  .news-story-drawer-backdrop,
  .notification-backdrop,
  .alert-inbox-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483600 !important;
  }

  .trade-flyout-panel,
  .market-ticker-live__flyout,
  .news-story-drawer,
  .notification-panel,
  .alert-inbox-panel,
  .research-agent-panel,
  [role="dialog"].trade-flyout-panel,
  [role="dialog"].market-ticker-live__flyout,
  [role="dialog"].news-story-drawer,
  [role="dialog"].notification-panel,
  [role="dialog"].alert-inbox-panel,
  [role="dialog"].research-agent-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483601 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(env(safe-area-inset-bottom, 0px) + 18px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
    translate: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
  }

  .trade-flyout-header,
  .market-ticker-live__flyout-topbar,
  .news-story-drawer__header,
  .notification-header,
  .alert-inbox-header,
  .research-agent-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    min-height: 48px !important;
    margin: -10px -14px 12px !important;
    padding: 12px 16px !important;
    border-radius: 0 !important;
    background: rgba(23, 50, 82, 0.92) !important;
    color: #fff !important;
    backdrop-filter: blur(20px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.12) !important;
  }

  .trade-flyout-header h1,
  .trade-flyout-header h2,
  .trade-flyout-header h3,
  .market-ticker-live__flyout-topbar h1,
  .market-ticker-live__flyout-topbar h2,
  .market-ticker-live__flyout-topbar h3,
  .news-story-drawer__header h1,
  .news-story-drawer__header h2,
  .news-story-drawer__header h3,
  .notification-header h1,
  .notification-header h2,
  .notification-header h3,
  .alert-inbox-header h1,
  .alert-inbox-header h2,
  .alert-inbox-header h3,
  .research-agent-header h1,
  .research-agent-header h2,
  .research-agent-header h3 {
    font-size: 1.05rem !important;
    line-height: 1.15 !important;
    margin: 0 !important;
  }

  .trade-flyout-close,
  .market-ticker-live__flyout-close,
  .notification-close,
  .shell-mobile-menu-close,
  .news-story-drawer__close,
  [class*="flyout-close"],
  [class*="drawer__close"],
  [aria-label="Close"],
  [aria-label*="Close details"] {
    display: none !important;
  }

  .news-story-drawer__hero,
  .trade-flyout-hero,
  .market-ticker-live__flyout-hero {
    margin-top: 0 !important;
  }
}

/* Alert inbox and flyout correction: centered full-screen panels for mobile/tablet. */
@media (max-width: 1180px) {
  body:has(.alert-inbox-panel),
  body:has(.trade-flyout-panel),
  body:has(.market-ticker-live__flyout),
  body:has(.news-story-drawer),
  body:has(.notification-panel),
  body:has(.research-agent-panel) {
    overflow: hidden !important;
  }

  .alert-inbox-backdrop,
  .trade-flyout-backdrop,
  .market-ticker-live__flyout-backdrop,
  .news-story-drawer-backdrop,
  .notification-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483620 !important;
  }

  .alert-inbox-panel,
  .trade-flyout-panel,
  .market-ticker-live__flyout,
  .news-story-drawer,
  .notification-panel,
  .research-agent-panel,
  aside.alert-inbox-panel,
  aside.trade-flyout-panel,
  aside.market-ticker-live__flyout,
  aside.news-story-drawer,
  aside.notification-panel,
  aside.research-agent-panel {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate3d(-50%, -50%, 0) !important;
    translate: none !important;
    z-index: 2147483621 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px calc(env(safe-area-inset-bottom, 0px) + 16px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  .alert-inbox-head,
  .trade-flyout-header,
  .market-ticker-live__flyout-topbar,
  .news-story-drawer__header,
  .notification-header,
  .research-agent-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    min-height: 46px !important;
    max-height: none !important;
    margin: -8px -12px 10px !important;
    padding: 10px 14px !important;
    border-radius: 0 !important;
    background: rgba(23, 50, 82, 0.92) !important;
    color: #fff !important;
  }

  .alert-inbox-head h1,
  .alert-inbox-head h2,
  .alert-inbox-head h3,
  .trade-flyout-header h1,
  .trade-flyout-header h2,
  .trade-flyout-header h3,
  .market-ticker-live__flyout-topbar h1,
  .market-ticker-live__flyout-topbar h2,
  .market-ticker-live__flyout-topbar h3,
  .news-story-drawer__header h1,
  .news-story-drawer__header h2,
  .news-story-drawer__header h3 {
    font-size: 1rem !important;
    line-height: 1.15 !important;
    margin: 0 !important;
  }

  .alert-inbox-actions .trade-flyout-close,
  .trade-flyout-close,
  .market-ticker-live__flyout-close,
  .notification-close,
  .news-story-drawer__close,
  [class*="flyout-close"],
  [class*="drawer__close"],
  [aria-label="Close"],
  [aria-label*="Close details"] {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Absolute final alert/flyout geometry and handle: no transforms, no trapped panel. */
@media (max-width: 1180px) {
  .alert-inbox-shell.open,
  .trade-flyout-shell.open,
  .market-ticker-live__flyout-shell,
  .news-story-drawer-shell.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483630 !important;
    display: block !important;
    overflow: hidden !important;
  }

  .alert-inbox-shell.open .alert-inbox-backdrop,
  .trade-flyout-backdrop,
  .market-ticker-live__flyout-backdrop,
  .news-story-drawer-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483631 !important;
    display: block !important;
  }

  .alert-inbox-shell.open .alert-inbox-panel,
  .alert-inbox-panel,
  .trade-flyout-panel,
  .market-ticker-live__flyout,
  .news-story-drawer,
  .notification-panel,
  .research-agent-panel {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: none !important;
    translate: none !important;
    z-index: 2147483632 !important;
    display: block !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .alert-inbox-swipe-close {
    position: sticky !important;
    top: 0 !important;
    z-index: 2147483633 !important;
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    height: 28px !important;
    min-height: 28px !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    touch-action: pan-y !important;
  }

  .alert-inbox-swipe-close span {
    display: block !important;
    width: 54px !important;
    height: 5px !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.82) !important;
    box-shadow: 0 1px 8px rgba(0,0,0,.24) !important;
  }
}
/* Mobile flyout stability patch: unify full-screen overlay behavior for CapitolTrades. */
@media (max-width: 1180px) {
  body:has(.alert-inbox-shell.open),
  body:has(.trade-flyout-shell.open),
  body:has(.market-ticker-live__flyout-shell),
  body:has(.news-story-drawer-shell.open) {
    overflow: hidden !important;
    height: 100dvh !important;
    overscroll-behavior: contain !important;
  }
  .alert-inbox-shell.open,
  .trade-flyout-shell.open,
  .market-ticker-live__flyout-shell,
  .news-story-drawer-shell.open,
  .notification-shell.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483644 !important;
    display: block !important;
  }
  .alert-inbox-shell.open .alert-inbox-backdrop,
  .trade-flyout-backdrop,
  .market-ticker-live__flyout-backdrop,
  .news-story-drawer-backdrop,
  .notification-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483645 !important;
    display: block !important;
  }
  .alert-inbox-shell.open .alert-inbox-panel,
  .trade-flyout-panel,
  .market-ticker-live__flyout,
  .news-story-drawer,
  .notification-panel,
  .research-agent-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483646 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: max(env(safe-area-inset-top, 0px), 10px) 0 max(env(safe-area-inset-bottom, 0px), 12px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
    translate: none !important;
    overflow: hidden !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    background: rgba(7, 20, 36, 0.94) !important;
  }
  .alert-inbox-swipe-close,
  .trade-flyout-handle,
  .market-ticker-live__flyout-handle,
  .news-story-drawer__handle,
  .notification-handle {
    position: relative !important;
    z-index: 2147483647 !important;
    flex: 0 0 auto !important;
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    min-height: 30px !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    touch-action: pan-y !important;
  }
  .alert-inbox-head,
  .trade-flyout-header,
  .market-ticker-live__flyout-topbar,
  .news-story-drawer__header,
  .notification-header,
  .research-agent-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 2147483647 !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 12px 16px !important;
    border-radius: 0 !important;
    background: rgba(23, 50, 82, 0.96) !important;
    color: #fff !important;
    backdrop-filter: blur(22px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.1) !important;
  }
  .alert-inbox-list,
  .alert-inbox-detail,
  .trade-flyout-body,
  .trade-flyout-content,
  .market-ticker-live__flyout-body,
  .news-story-drawer__body,
  .notification-body,
  .research-agent-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }
  .shell-header,
  .shell-toolbar,
  .shell-mobile-bar {
    z-index: 10 !important;
  }
  .trade-flyout-close,
  .market-ticker-live__flyout-close,
  .notification-close,
  .news-story-drawer__close,
  .research-agent-close,
  .alert-inbox-actions .trade-flyout-close {
    display: none !important;
  }
}/* Mobile flyout geometry v2: alert inbox owns the full mobile viewport. */
@media (max-width: 1180px) {
  body:has(.alert-inbox-shell.open) .shell-header-panel,
  body:has(.alert-inbox-shell.open) .shell-menu-backdrop,
  body:has(.alert-inbox-shell.open) .shell-mobile-bottom-nav {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  .alert-inbox-shell.open .alert-inbox-panel {
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 12px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
  }
  .alert-inbox-shell.open .alert-inbox-panel > * {
    width: 100% !important;
  }
  .alert-inbox-swipe-close {
    min-height: 44px !important;
    height: 44px !important;
  }
  .alert-inbox-mailboxes,
  .alert-inbox-list,
  .alert-inbox-reader,
  .alert-inbox-head,
  .empty-state {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }
}/* Mobile flyout geometry v3: alert inbox suppresses app chrome and stays fully visible. */
@media (max-width: 1180px) {
  body:has(.alert-inbox-shell.open) .shell-header,
  body:has(.alert-inbox-shell.open) .shell-header-inner,
  body:has(.alert-inbox-shell.open) .shell-mobile-bottom-nav,
  body:has(.alert-inbox-shell.open) .shell-header-panel,
  body:has(.alert-inbox-shell.open) .shell-menu-backdrop {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  .alert-inbox-shell.open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483646 !important;
  }
  .alert-inbox-shell.open .alert-inbox-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important;
  }
  .alert-inbox-shell.open .alert-inbox-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483648 !important;
    padding-top: 0 !important;
    background: rgba(7, 20, 36, 0.98) !important;
  }
  .alert-inbox-swipe-close {
    position: sticky !important;
    top: 0 !important;
    z-index: 2147483649 !important;
    background: linear-gradient(180deg, rgba(7,20,36,0.98), rgba(7,20,36,0.74)) !important;
  }
}
/* iOS height correction: 100vh fallback before 100dvh for alert inbox */
@media (max-width: 1180px) {
  .alert-inbox-shell.open .alert-inbox-panel {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
  }
}
/* Pull-to-refresh guard for Capitol mobile drawers */
@media (max-width: 1180px) {
  html:has(.alert-inbox-shell.open),
  body:has(.alert-inbox-shell.open) {
    overscroll-behavior-y: none !important;
  }

  .alert-inbox-shell.open,
  .alert-inbox-shell.open .alert-inbox-panel,
  .alert-inbox-shell.open .alert-inbox-list,
  .alert-inbox-shell.open .alert-inbox-reader {
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
  }

  .alert-inbox-shell.open .alert-inbox-panel,
  .alert-inbox-shell.open .alert-inbox-list,
  .alert-inbox-shell.open .alert-inbox-reader {
    -webkit-overflow-scrolling: touch !important;
  }
}



/* Hard lock for Chrome pull-to-refresh while Capitol alert inbox is open */
@media (max-width: 1180px) {
  html.alert-inbox-open,
  body.alert-inbox-open {
    overscroll-behavior-y: none !important;
    overflow: hidden !important;
    height: 100dvh !important;
    touch-action: none !important;
  }

  body.alert-inbox-open .alert-inbox-shell.open,
  body.alert-inbox-open .alert-inbox-shell.open .alert-inbox-panel,
  body.alert-inbox-open .alert-inbox-shell.open .alert-inbox-list,
  body.alert-inbox-open .alert-inbox-shell.open .alert-inbox-reader {
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
  }
}
