/**
 * Mobile browser UI styles 
 */


@media (max-width: 599px) {
  :root {
    --mobile-browser-height: calc(56px + env(safe-area-inset-bottom, 0px));
  }


  html:not(.mobile-browser-off) body {
    padding-bottom: var(--mobile-browser-height) !important;
  }

  html:not(.mobile-browser-off) .tds-shell {
    --tds-shell-footer-height: 0px;
    padding-bottom: 0 !important;
  }


  html:not(.mobile-browser-off) .tds-layout > .tds-layout-aside,
  html:not(.mobile-browser-off) .tds-layout > .parts-layout-aside-with-rail {
    display: none !important;
  }

  html:not(.mobile-browser-off) .tds-shell-footer.tds-shell-footer--is_sticky,
  html:not(.mobile-browser-off) #footer.tds-shell-footer {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
  }

  /* Kill any leftover sticky third-rail chrome  */
  html:not(.mobile-browser-off) .tds-layout .third-rail,
  html:not(.mobile-browser-off) .tds-layout-aside.third-rail {
    position: static !important;
    bottom: auto !important;
    top: auto !important;
    z-index: auto !important;
  }

  .mobile-browser-sheet .tds-layout-aside,
  .mobile-browser-sheet .parts-layout-aside-with-rail {
    display: block !important;
    position: static !important;
    height: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    border: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ========== Mobile browser (sticky footer icon bar + sheets) ========== */
.mobile-browser {
  display: none;
  position: fixed !important;
  left: 0;
  right: auto;
  bottom: auto;
  top: auto;
  width: 100%;
  max-width: none;
  margin: 0 !important;
  z-index: 10000 !important;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  min-height: 56px;
  box-sizing: border-box;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--tds-color-white, #fff);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

/* Show bar whenever JS has mounted it */
body.mobile-browser-active .mobile-browser,
.mobile-browser.mobile-browser--ready {
  display: flex !important;
}

.mobile-browser__btn {
  flex: 1 1 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--tds-color--grey80, #393c41);
  cursor: pointer;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}

.mobile-browser__btn:hover,
.mobile-browser__btn:focus-visible {
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

.mobile-browser__btn[aria-pressed="true"] {
  color: var(--tds-color--blue50, #3e6ae1);
}

.mobile-browser__btn .tds-icon {
  width: 24px;
  height: 24px;
}

.mobile-browser__btn[hidden] {
  display: none !important;
}

.mobile-browser__label {
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-browser__copy {
  display: none;
}

.mobile-browser-sheet.tds-modal {

  z-index: 10050;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: #fff;
  color: inherit;
  position: fixed !important;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
  overscroll-behavior: contain;
  transform: none !important;
}

.mobile-browser-sheet.mobile-browser-sheet--side {
  border-radius: 0;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.mobile-browser-sheet.mobile-browser-sheet--bottom {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(85dvh, 640px);
  max-height: min(85vh, 640px);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

.mobile-browser-sheet::backdrop {
  background: rgba(0, 0, 0, 0.45);
  /* Ensure backdrop covers scrolled page content */
  position: fixed;
  inset: 0;
}

/* Hide bottom chrome while a sheet is open so it cannot cut the modal */
body.mobile-browser-sheet-open .mobile-browser {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Page scroll is locked via body position:fixed in JS; keep html from bouncing */
html.mobile-browser-sheet-open,
html.mobile-browser-sheet-open body {
  overscroll-behavior: none;
  touch-action: none;
}

html.mobile-browser-sheet-open .mobile-browser-sheet__body {
  touch-action: pan-x pan-y;
}

.mobile-browser-sheet__header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.mobile-browser-sheet__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: static !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  max-width: none !important;
}

.mobile-browser-sheet__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  position: static !important;
  inset: auto !important;
}

.mobile-browser-sheet__close:hover,
.mobile-browser-sheet__close:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}

.mobile-browser-sheet__close .tds-icon {
  width: 20px;
  height: 20px;
}

.mobile-browser-sheet__body {
  flex: 1 1 auto;
  min-height: 0 !important; 
  min-width: 0 !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

.mobile-browser-sheet--bottom .mobile-browser-sheet__body {
  max-height: none; 
}

.mobile-browser-sheet .mobile-browser-sheet-host {
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

@media (max-width: 599px) {
  .mobile-browser-sheet.mobile-browser-sheet--side {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
  }
}

.mobile-browser-sheet .side-nav {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

.mobile-browser-sheet .mobile-capable-toggle {
  margin-bottom: 12px;
}

.mobile-browser-sheet #toggle-third-rail {
  display: none !important;
}

/* Nested third-rail must not create a second non-scrolling clip region */
.mobile-browser-sheet .tds-layout-aside,
.mobile-browser-sheet .parts-layout-aside-with-rail,
.mobile-browser-sheet .third-rail,
.mobile-browser-sheet .third-rail-body,
.mobile-browser-sheet .third-rail-toc,
.mobile-browser-sheet .side-nav.third-rail-body {
  display: block !important;
  position: static !important;
  top: auto !important;
  bottom: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  width: 100% !important;
  max-width: 100% !important;
}

.mobile-browser-sheet .sticky-cta {
  width: 100%;
  margin-bottom: 12px;
  position: static !important;
}

.mobile-browser-sheet img,
.mobile-browser-sheet table,
.mobile-browser-sheet pre {
  max-width: 100%;
}

.mobile-browser-actions-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-browser-actions-list li {
  margin: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mobile-browser-actions-list a,
.mobile-browser-actions-list button.mobile-browser-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.mobile-browser-actions-list a:hover,
.mobile-browser-actions-list button.mobile-browser-action-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.mobile-browser-actions-list .tds-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.mobile-browser-actions-copy {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.875rem;
  color: var(--tds-color--grey60, #5c5e62);
}

@media print {
  .mobile-browser,
  .mobile-browser-sheet {
    display: none !important;
    visibility: hidden !important;
  }
}

@media (min-width: 600px) {
  .mobile-browser,
  .mobile-browser-sheet {
    display: none !important;
  }
}

/* Raise EnergyIQ FAB above mobile browser bar when both are present */
html.energyiq-enabled body.mobile-browser-active assist-chatbot#chatbot {
  bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
}

