/* Version 3.98317: Mobile shell v2 — route-specific document and board scrolling. */

.mobile-bottom-nav {
  display: none;
}

.mobile-more-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-more-customize {
  min-height: 40px;
  margin: 0;
  border: 1px solid #cbd9e7;
  border-radius: 12px;
  background: #eef6fd;
  color: #17649f;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.mobile-more-customize-section {
  margin: 0 0 14px;
}

.mobile-more-customize-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 66px;
  margin: 0;
  border: 1px solid #bfd4e7;
  border-radius: 16px;
  background: #eef6fd;
  color: #18283a;
  padding: 10px 13px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.mobile-more-customize-card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: #2878ba;
  color: #fff;
}

.mobile-more-customize-card-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.mobile-more-customize-card > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.mobile-more-customize-card strong {
  color: #18283a;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.mobile-more-customize-card small {
  color: #62758a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.mobile-more-customize-card > b {
  color: #2474b5;
  font-size: 27px;
  line-height: 1;
}

.mobile-bottom-shortcut-dialog {
  width: min(660px, calc(100vw - 28px));
  max-width: 660px;
  max-height: min(820px, calc(100dvh - 28px));
  margin: auto;
  border: 0;
  border-radius: 24px;
  background: #f5f8fb;
  color: #18283a;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(7, 24, 40, .28);
}

.mobile-bottom-shortcut-dialog::backdrop {
  background: rgba(10, 27, 43, .66);
  backdrop-filter: blur(5px);
}

.mobile-bottom-shortcut-dialog form {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: 100%;
  max-height: min(820px, calc(100dvh - 28px));
  overflow: hidden;
}

.mobile-bottom-shortcut-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid #d6e1ec;
  background: #fff;
}

.mobile-bottom-shortcut-head > div { min-width: 0; }
.mobile-bottom-shortcut-head span { display: block; color: #2474b5; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.mobile-bottom-shortcut-head h2 { margin: 2px 0 1px; color: #18283a; font-size: 24px; line-height: 1.1; }
.mobile-bottom-shortcut-head p { margin: 0; color: #65758a; font-size: 13px; font-weight: 650; }
.mobile-bottom-shortcut-head > button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  margin: 0;
  border: 1px solid #cbd9e7;
  border-radius: 14px;
  background: #f7f9fc;
  color: #18283a;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.mobile-bottom-shortcut-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, .42fr);
  gap: 10px;
  padding: 14px 16px 10px;
  background: #f5f8fb;
}

.mobile-bottom-shortcut-tools label {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 46px;
  border: 1px solid #cbd9e7;
  border-radius: 13px;
  background: #fff;
  padding: 0 13px;
}
.mobile-bottom-shortcut-tools svg { flex: 0 0 20px; width: 20px; height: 20px; margin-right: 8px; fill: none; stroke: #65758a; stroke-width: 2; stroke-linecap: round; }
.mobile-bottom-shortcut-tools input,
.mobile-bottom-shortcut-tools select { width: 100%; min-width: 0; height: 44px; margin: 0; border: 0; outline: 0; background: transparent; color: #18283a; font: inherit; font-size: 14px; font-weight: 750; }
.mobile-bottom-shortcut-tools select { border: 1px solid #cbd9e7; border-radius: 13px; background: #fff; padding: 0 10px; }

.mobile-bottom-shortcut-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 17px 10px;
  border-bottom: 1px solid #d6e1ec;
}
.mobile-bottom-shortcut-status strong { color: #53667b; font-size: 13px; }
.mobile-bottom-shortcut-status button { margin: 0; border: 0; background: transparent; color: #2474b5; padding: 5px; font: inherit; font-size: 13px; font-weight: 850; }

.mobile-bottom-shortcut-options {
  min-height: 0;
  padding: 8px 12px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.mobile-bottom-shortcut-option {
  display: grid;
  grid-template-columns: 28px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  border-bottom: 1px solid #dbe4ed;
  padding: 8px 5px;
  cursor: pointer;
}
.mobile-bottom-shortcut-option[hidden] { display: none; }
.mobile-bottom-shortcut-option > input { width: 22px; height: 22px; margin: 0; accent-color: #2878ba; }
.mobile-bottom-shortcut-option > input:disabled { opacity: .35; }
.mobile-bottom-shortcut-option-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #e8f3fc; color: #17649f; font-size: 19px; font-weight: 900; }
.mobile-bottom-shortcut-option-icon svg { width: 22px; height: 22px; fill: currentColor; }
.mobile-bottom-shortcut-option-copy { display: grid; min-width: 0; gap: 1px; }
.mobile-bottom-shortcut-option small { color: #687a8e; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.mobile-bottom-shortcut-option strong { overflow: hidden; color: #18283a; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-bottom-shortcut-option em { overflow: hidden; color: #66778a; font-size: 12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.mobile-bottom-shortcut-order { display: flex; gap: 4px; }
.mobile-bottom-shortcut-option:not(.is-selected) .mobile-bottom-shortcut-order { visibility: hidden; pointer-events: none; }
.mobile-bottom-shortcut-order button { display: grid; place-items: center; width: 32px; height: 32px; margin: 0; border: 1px solid #cfdae6; border-radius: 9px; background: #fff; color: #315c80; padding: 0; font-size: 16px; font-weight: 900; }
.mobile-bottom-shortcut-order button:disabled { opacity: .3; }

.mobile-bottom-shortcut-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  padding: 11px 14px calc(11px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #d4dfeb;
  background: #fff;
  box-shadow: 0 -8px 20px rgba(20, 45, 68, .08);
}
.mobile-bottom-shortcut-actions button { min-height: 48px; margin: 0; border: 1px solid #c8d6e4; border-radius: 13px; background: #fff; color: #18283a; padding: 9px 12px; font: inherit; font-size: 15px; font-weight: 900; }
.mobile-bottom-shortcut-actions button:last-child { border-color: #2878ba; background: #2878ba; color: #fff; }
.mobile-bottom-shortcut-actions button:disabled { opacity: .55; }

@media (max-width: 720px) {
  .mobile-bottom-shortcut-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
  }
  .mobile-bottom-shortcut-dialog form { max-height: calc(100dvh - 20px); }
  .mobile-bottom-shortcut-head { padding: 15px 15px 13px; }
  .mobile-bottom-shortcut-head h2 { font-size: 21px; }
  .mobile-bottom-shortcut-tools { grid-template-columns: 1fr; padding: 11px 12px 8px; }
  .mobile-bottom-shortcut-tools select { height: 42px; }
  .mobile-bottom-shortcut-status { padding: 0 13px 8px; }
  .mobile-bottom-shortcut-options { padding: 5px 10px 12px; }
  .mobile-bottom-shortcut-option { grid-template-columns: 25px 38px minmax(0, 1fr) auto; gap: 8px; min-height: 60px; }
  .mobile-bottom-shortcut-option-icon { width: 38px; height: 38px; }
  .mobile-bottom-shortcut-order { display: grid; grid-template-columns: 30px 30px; }
  .mobile-bottom-shortcut-order button { width: 30px; height: 30px; }
  .mobile-more-customize { min-height: 38px; padding: 7px 10px; font-size: 12px; }

  .mobile-bottom-nav:not([hidden]) {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    margin: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    min-height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #2d3c50;
    background: #13202b;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

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

  .mobile-bottom-tab {
    display: inline-grid;
    flex: 1 1 0;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #9fb0c3;
    padding: 6px 4px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .mobile-bottom-tab.is-holding {
    background: #213a50;
    color: #fff;
    transform: scale(.97);
  }

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

  .mobile-bottom-tab svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  .mobile-bottom-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-tab.is-active,
  .mobile-bottom-tab[aria-current="page"] {
    background: #243243;
    color: #f8fafc;
  }

  .mobile-bottom-tab:focus-visible {
    outline: 2px solid #5b9bd5;
    outline-offset: 1px;
  }

  /* Safe area on sticky mobile header */
  .sidebar {
    padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
  }

  /* Safari only collapses its browser chrome when the document owns scrolling. */
  .main {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html.mobile-nav-shell-active,
  html.mobile-nav-shell-active > body {
    width: 100%;
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html.mobile-nav-shell-active body > .app-shell {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
  }

  /* The header is a sibling of the flexible page scroller. Prevent flexbox from
     shrinking it when Dashboard content and the bottom tabs share the viewport. */
  html.mobile-nav-shell-active body > .app-shell > .sidebar {
    width: 100% !important;
    min-height: calc(62px + env(safe-area-inset-top, 0px)) !important;
    height: calc(62px + env(safe-area-inset-top, 0px)) !important;
    max-height: calc(62px + env(safe-area-inset-top, 0px)) !important;
    padding: calc(9px + env(safe-area-inset-top, 0px)) 12px 9px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  /* The persistent bottom bar owns mobile navigation. Keep the balanced header
     shell for the centered logo and profile, but remove its duplicate menu. */
  html.mobile-nav-shell-active body > .app-shell > .sidebar > .mobile-menu-toggle,
  html.mobile-nav-shell-active body > .app-shell > .sidebar > .nav-list.mobile-nav-open {
    display: none !important;
  }

  html.mobile-nav-shell-active body > .app-shell > .sidebar > .brand {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html.mobile-nav-shell-active body > .app-shell > .sidebar .brand-logo {
    display: block !important;
    width: 108px !important;
    max-width: 108px !important;
    height: 44px !important;
    max-height: 44px !important;
    padding: 4px !important;
    object-fit: contain !important;
    box-sizing: border-box !important;
  }

  html.mobile-nav-shell-active body > .app-shell > .main {
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Operational load boards need one bounded touch scroller so their sticky
     totals, user filters, and compact rows move as a single board. Dashboard
     and ordinary workspaces continue to use document scrolling above. */
  html.mobile-nav-shell-active.mobile-global-board-scroll-active,
  html.mobile-nav-shell-active.mobile-global-board-scroll-active > body {
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: hidden !important;
    overscroll-behavior-y: none !important;
  }

  html.mobile-nav-shell-active.mobile-global-board-scroll-active body > .app-shell {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  html.mobile-nav-shell-active.mobile-global-board-scroll-active body > .app-shell > .main {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
  }

  html.mobile-nav-shell-active body > .mobile-bottom-nav:not([hidden]) {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    z-index: 2147483000 !important;
    transform: none !important;
    -webkit-transform: none !important;
  }

  /* Keep dropdown menu above the tab bar */
  .nav-list.mobile-nav-open {
    max-height: min(70dvh, calc(100dvh - 140px - env(safe-area-inset-bottom, 0px))) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Authentication wins over every mobile shell layout. The normal mobile
     shell intentionally forces the app back into view, so repeat the lock at
     the end of this cascade with equal-or-greater specificity. */
  html.mobile-nav-shell-active > body.auth-locked > .app-shell,
  html.mobile-nav-shell-active.mobile-global-board-scroll-active > body.auth-locked > .app-shell {
    display: none !important;
  }

  html.mobile-nav-shell-active > body.auth-locked > .mobile-bottom-nav {
    display: none !important;
  }

  html.mobile-nav-shell-active > body.auth-locked > .login-screen {
    z-index: 2147483647;
    background: #16202b;
  }
}
