/**
 * Waypoint Fold / tablet command surface.
 *
 * ADDITIVE ONLY. Every rule is scoped under html.waypoint-fold-tablet
 * (and [data-device-mode="fold-tablet"]). These selectors never match
 * laptop / desktop / large-monitor / extended-display sessions because
 * foldTablet.js will not set the class unless the device is touch-primary
 * AND the CSS viewport is in the unfolded-Fold / tablet range.
 *
 * Laptop + extended monitor (1280–3440, hover/fine pointer) stay on
 * viewport.css tokens: laptop / desktop / big. Do not copy these
 * declarations into unscoped selectors.
 */

html.waypoint-fold-tablet,
html[data-device-mode="fold-tablet"] {
  --fold-safe-top: env(safe-area-inset-top, 0px);
  --fold-safe-right: env(safe-area-inset-right, 0px);
  --fold-safe-bottom: env(safe-area-inset-bottom, 0px);
  --fold-safe-left: env(safe-area-inset-left, 0px);
  --nav-rail-w: 52px;
  --shell-max: 100%;
  --shell-pad-x: 8px;
  --shell-pad-y: 6px;
  --shell-gap: 8px;
  --touch-min: 32px;
  --btn-h: 30px;
  --btn-h-sm: 26px;
  --type-root: 12px;
  --card-pad: 8px;
  --msg-dock-inset: 12px;
  overflow-x: hidden;
}

html.waypoint-fold-tablet body,
html[data-device-mode="fold-tablet"] body {
  overflow-x: hidden;
  min-height: 100dvh;
  min-height: 100svh;
  padding-left: var(--fold-safe-left);
  padding-right: var(--fold-safe-right);
}

html.waypoint-fold-tablet *,
html.waypoint-fold-tablet *::before,
html.waypoint-fold-tablet *::after {
  box-sizing: border-box;
}

/* ===== Shell / navigation ===== */

html.waypoint-fold-tablet .command-deck-layout {
  grid-template-columns: var(--nav-rail-w) minmax(0, 1fr) !important;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

html.waypoint-fold-tablet .nav-rail {
  width: var(--nav-rail-w);
  min-width: var(--nav-rail-w);
  padding: 8px 4px calc(8px + var(--fold-safe-bottom));
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  height: 100%;
  max-height: calc(100dvh - var(--desk-header-h, 56px));
}

html.waypoint-fold-tablet .nav-rail-btn,
html.waypoint-fold-tablet .nav-rail-btn-labeled,
html.waypoint-fold-tablet .nav-rail-btn-pirate {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 6px 2px 4px;
  gap: 2px;
  border-radius: 10px;
}

html.waypoint-fold-tablet .nav-rail-caption {
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.waypoint-fold-tablet .nav-rail-art,
html.waypoint-fold-tablet .nav-rail-svg,
html.waypoint-fold-tablet .nav-rail-pete-art,
html.waypoint-fold-tablet .nav-rail-pete-photo,
html.waypoint-fold-tablet .nav-rail-social-art {
  width: 26px;
  height: 26px;
}

html.waypoint-fold-tablet .nav-rail-enhanced .nav-rail-emblem {
  --brand-emblem-size: 28px;
}

html.waypoint-fold-tablet .nav-rail-brand .brand-text {
  display: none;
}

/* ===== Header ===== */

html.waypoint-fold-tablet .desk-header {
  min-height: 52px;
  padding: 6px 10px;
  padding-top: max(6px, var(--fold-safe-top));
  gap: 8px;
  flex-wrap: wrap;
  overflow: visible;
}

html.waypoint-fold-tablet .desk-product-line {
  display: none;
}

html.waypoint-fold-tablet .desk-title {
  font-size: clamp(0.78rem, 1.8vw, 0.95rem);
  white-space: nowrap;
}

html.waypoint-fold-tablet .desk-header-meta {
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

html.waypoint-fold-tablet .display-mode-control {
  display: none !important;
}

html.waypoint-fold-tablet .quote-strip,
html.waypoint-fold-tablet #liveQuoteStrip {
  flex-wrap: wrap;
  max-width: min(520px, 100%);
  gap: 4px 8px;
  padding: 4px 8px;
  min-height: 44px;
}

html.waypoint-fold-tablet .quote-label,
html.waypoint-fold-tablet .quote-price {
  font-size: 0.72rem;
}

html.waypoint-fold-tablet .desk-header .btn,
html.waypoint-fold-tablet .desk-header .btn-sm,
html.waypoint-fold-tablet .status-cluster-toggle,
html.waypoint-fold-tablet .execution-journal-open-btn,
html.waypoint-fold-tablet .pete-brainscan-toggle-icon {
  min-height: 44px;
  min-width: 44px;
}

html.waypoint-fold-tablet .pete-watch-heartbeat {
  max-width: min(240px, 100%);
}
html.waypoint-fold-tablet .pete-watch-heartbeat-btn {
  min-height: 44px;
  padding: 6px 10px;
}
html.waypoint-fold-tablet .pete-watch-heartbeat-details {
  right: auto;
  left: 0;
}

html.waypoint-fold-tablet #bloombergToggleHeaderBtn {
  font-size: 0.62rem;
  padding: 6px 8px;
  letter-spacing: 0.02em;
}

html.waypoint-fold-tablet #openMyAccountLabel {
  font-size: 0.68rem;
}

/* Hover-only tips become tap/focus visible */
html.waypoint-fold-tablet .execution-journal-open-btn:focus .execution-journal-open-tip,
html.waypoint-fold-tablet .pete-brainscan-toggle-icon:focus .pete-brainscan-open-tip {
  opacity: 1;
  visibility: visible;
}

/* ===== Persistent workspace ===== */

html.waypoint-fold-tablet .deck-persistent-shell,
html.waypoint-fold-tablet body:not(.helm-mode):not(.trade-log-mode):not(.store-mode):not(.training-portal-mode):not(.competitive-intel-mode):not(.development-mode):not(.admin-hub-mode):not(.event-radar-mode):not(.social-mode) .deck-persistent-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  padding: 8px 10px 10px !important;
  gap: 10px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  margin: 0 !important;
}

html.waypoint-fold-tablet[data-fold-layout="split"] body:not(.helm-mode):not(.trade-log-mode):not(.store-mode):not(.training-portal-mode):not(.competitive-intel-mode):not(.development-mode):not(.admin-hub-mode):not(.event-radar-mode):not(.social-mode) .deck-persistent-shell {
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.75fr) !important;
}

html.waypoint-fold-tablet .deck-workspace,
html.waypoint-fold-tablet .panel,
html.waypoint-fold-tablet .panel-avatar,
html.waypoint-fold-tablet .ad-win,
html.waypoint-fold-tablet .th-win {
  min-width: 0;
  max-width: 100%;
}

html.waypoint-fold-tablet #instrumentRail {
  display: none !important;
}

html.waypoint-fold-tablet .panel-avatar {
  max-height: none;
  position: relative;
}

html.waypoint-fold-tablet .btn,
html.waypoint-fold-tablet .btn-sm,
html.waypoint-fold-tablet input,
html.waypoint-fold-tablet select,
html.waypoint-fold-tablet textarea,
html.waypoint-fold-tablet .ws-nav-btn,
html.waypoint-fold-tablet .ws-chrome-btn,
html.waypoint-fold-tablet .ws-tab,
html.waypoint-fold-tablet .ws-feed-tab {
  min-height: var(--touch-min);
}

html.waypoint-fold-tablet .btn + .btn,
html.waypoint-fold-tablet .paper-ticket-actions .btn {
  margin-inline: 0;
}

/* ===== Analysis desk — stacked command tablet, do not persist these rects ===== */

html.waypoint-fold-tablet .ad-desk-host,
html.waypoint-fold-tablet body.analysis-mode .ad-desk-host:not([hidden]) {
  height: auto;
  max-height: none;
  min-height: 0;
}

html.waypoint-fold-tablet body.analysis-mode.ad-full-desk .deck-persistent-shell {
  height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  overflow: hidden !important;
  padding: 8px 10px !important;
}

html.waypoint-fold-tablet .ad-layout-canvas {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.waypoint-fold-tablet .ad-win {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 140px;
  max-width: 100% !important;
}

html.waypoint-fold-tablet .ad-win[data-layout-id="chart"] {
  order: -3;
  min-height: min(42dvh, 480px);
  flex: 0 0 auto;
}

html.waypoint-fold-tablet .ad-win[data-layout-id="pete"] {
  order: -2;
  min-height: min(28dvh, 280px);
}

html.waypoint-fold-tablet .ad-win[data-layout-id="analysis"],
html.waypoint-fold-tablet .ad-win[data-layout-id="thesis"] {
  order: -1;
}

html.waypoint-fold-tablet .ad-win-resize,
html.waypoint-fold-tablet .ad-win-title-hint,
html.waypoint-fold-tablet .th-win-resize,
html.waypoint-fold-tablet .th-win-title-hint {
  display: none !important;
}

html.waypoint-fold-tablet .ad-win-popout {
  display: inline-flex !important;
}

html.waypoint-fold-tablet .ad-win[data-layout-id="mgmt"],
html.waypoint-fold-tablet .ad-win[data-layout-id="position"],
html.waypoint-fold-tablet .ad-win[data-layout-id="livePos"] {
  display: none !important;
}

html.waypoint-fold-tablet .ad-win-title,
html.waypoint-fold-tablet .th-win-title {
  cursor: default;
  min-height: 40px;
  touch-action: manipulation;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .ad-layout-canvas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .ad-win[data-layout-id="chart"] {
  grid-column: 1 / -1;
}

html.waypoint-fold-tablet .ad-layout-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
}

html.waypoint-fold-tablet #analysisChartPanel,
html.waypoint-fold-tablet .chart-host,
html.waypoint-fold-tablet .tv-chart,
html.waypoint-fold-tablet [data-chart],
html.waypoint-fold-tablet #analysisChartPanel iframe,
html.waypoint-fold-tablet .chart-host iframe {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

html.waypoint-fold-tablet canvas {
  max-width: 100%;
}

/* ===== BrainScan — dominant Fold presentation, same visual identity ===== */

html.waypoint-fold-tablet .pete-brainscan-panel:not(.is-minimized) {
  left: calc(var(--nav-rail-w, 56px) + 6px) !important;
  right: 6px !important;
  top: calc(var(--desk-header-h, 56px) + 6px) !important;
  bottom: 6px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 10px;
}

html.waypoint-fold-tablet .pete-brainscan-panel.pbs-instrument:not(.is-minimized) {
  width: auto !important;
  height: auto !important;
}

html.waypoint-fold-tablet .pete-brainscan-panel.pbs-instrument .pbs-shell-content {
  padding: 8px 8px 10px;
  min-height: 0;
}

html.waypoint-fold-tablet .pete-brainscan-panel.pbs-instrument .pete-brainscan-body {
  display: grid;
  grid-template-columns: 1fr !important;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 6px;
}

html.waypoint-fold-tablet .pete-brainscan-panel.pbs-instrument .pete-brainscan-stage {
  grid-column: 1 !important;
  grid-row: 1;
  min-height: min(46dvh, 560px);
  min-width: 0;
}

html.waypoint-fold-tablet .pete-brainscan-panel.pbs-instrument .pbs-rail,
html.waypoint-fold-tablet .pete-brainscan-panel.pbs-instrument .pete-brainscan-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  width: 100%;
  max-height: none;
  opacity: 1;
  font-size: 0.62rem;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .pete-brainscan-panel.pbs-instrument .pete-brainscan-body {
  grid-template-columns: minmax(0, 1fr) minmax(168px, 220px) !important;
  grid-template-rows: minmax(0, 1fr) auto;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .pete-brainscan-panel.pbs-instrument .pete-brainscan-stage {
  grid-column: 1;
  grid-row: 1 / span 2;
  min-height: 0;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .pete-brainscan-panel.pbs-instrument .pbs-rail {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .pete-brainscan-panel.pbs-instrument .pete-brainscan-side {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
}

html.waypoint-fold-tablet .pbs-head-row,
html.waypoint-fold-tablet .pbs-head-actions {
  flex-wrap: wrap;
  gap: 6px;
}

html.waypoint-fold-tablet #peteBrainScanGrowthOpen {
  min-height: 44px;
  min-width: 44px;
}

html.waypoint-fold-tablet .pbs-growth-card {
  width: min(100%, 520px);
  max-height: min(78vh, 640px);
}

html.waypoint-fold-tablet .pbs-growth-chart {
  width: 100%;
  height: auto;
}

html.waypoint-fold-tablet .pbs-quality button,
html.waypoint-fold-tablet .pbs-text-btn,
html.waypoint-fold-tablet .pbs-cta,
html.waypoint-fold-tablet .pbs-icon-btn,
html.waypoint-fold-tablet .pbs-close,
html.waypoint-fold-tablet #peteBrainScanAsk,
html.waypoint-fold-tablet #peteBrainScanHelp {
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  font-size: 0.62rem;
}

html.waypoint-fold-tablet .pbs-poke {
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.72rem;
  left: 10px;
  bottom: 10px;
}

html.waypoint-fold-tablet .pbs-zoom {
  right: 10px;
  bottom: 10px;
  gap: 6px;
}

html.waypoint-fold-tablet .pbs-zoom button {
  width: 44px;
  height: 44px;
  font-size: 1.15rem;
}

html.waypoint-fold-tablet .pbs-search input {
  height: 44px;
  max-width: none;
  width: min(280px, 70vw);
  font-size: 0.78rem;
}

html.waypoint-fold-tablet .pete-brainscan-resize {
  display: none;
}

html.waypoint-fold-tablet .pbs-help-card,
html.waypoint-fold-tablet .pbs-output-menu {
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
}

html.waypoint-fold-tablet .pete-brainscan-panel.is-minimized {
  width: min(320px, calc(100vw - 24px)) !important;
  right: 10px !important;
  left: auto !important;
  top: auto !important;
  bottom: calc(12px + var(--fold-safe-bottom)) !important;
}

/* ===== Guardian / Trade Hub ===== */

html.waypoint-fold-tablet body.trade-log-mode .command-deck-layout,
html.waypoint-fold-tablet body.helm-mode .command-deck-layout {
  height: 100dvh !important;
  max-height: 100dvh !important;
}

html.waypoint-fold-tablet body.trade-log-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.helm-mode .deck-persistent-shell {
  height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  padding: 8px 10px !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet body.trade-log-mode .trade-hub-shell,
html.waypoint-fold-tablet body.helm-mode .helm-layout,
html.waypoint-fold-tablet .mc-paper-futures-deck {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
}

html.waypoint-fold-tablet body.trade-log-mode .mc-row-top,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-ticket-pos,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-venue-ticket,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-positions-orders,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-tables,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-tables-2 {
  grid-template-columns: minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet[data-fold-layout="split"] body.trade-log-mode .mc-row-venue-ticket,
html.waypoint-fold-tablet[data-fold-layout="split"] body.trade-log-mode .mc-row-positions-orders,
html.waypoint-fold-tablet[data-fold-layout="split"] body.trade-log-mode .mc-row-tables-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

html.waypoint-fold-tablet .th-layout-canvas {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible;
}

html.waypoint-fold-tablet .th-win {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 180px;
  max-width: 100% !important;
}

html.waypoint-fold-tablet .paper-side-segment {
  gap: 8px;
  padding: 4px;
}

html.waypoint-fold-tablet .paper-side-seg {
  min-height: 48px;
  font-size: 0.88rem;
}

html.waypoint-fold-tablet .paper-ticket-actions {
  gap: 12px;
}

html.waypoint-fold-tablet .paper-ticket-actions .btn,
html.waypoint-fold-tablet .btn-ticket-execute,
html.waypoint-fold-tablet .btn-ticket-flatten,
html.waypoint-fold-tablet .btn-ticket-reverse {
  min-height: 48px;
  flex: 1 1 140px;
}

html.waypoint-fold-tablet .btn-ticket-flatten {
  margin-top: 4px;
}

html.waypoint-fold-tablet body.trade-log-mode .trade-hub-tab,
html.waypoint-fold-tablet body.trade-log-mode .paper-horizon-tab {
  min-height: 44px;
  padding: 8px 12px;
}

html.waypoint-fold-tablet .trade-table-wrap,
html.waypoint-fold-tablet .options-chain-pro,
html.waypoint-fold-tablet .paper-table-compact {
  overflow-x: auto;
  max-width: 100%;
}

html.waypoint-fold-tablet body.trade-log-mode .paper-shared-open-panel,
html.waypoint-fold-tablet body.trade-log-mode .paper-working-side,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-venue-ticket > .panel {
  max-height: none;
}

html.waypoint-fold-tablet .helm-header {
  gap: 10px;
}

html.waypoint-fold-tablet .helm-layout > * {
  min-width: 0;
  max-width: 100%;
}

/* ===== Social ===== */

html.waypoint-fold-tablet body.social-mode .deck-persistent-shell {
  padding: 0 !important;
}

html.waypoint-fold-tablet .ws-app,
html.waypoint-fold-tablet .ws-app:has(.ws-rail.is-collapsed) {
  grid-template-columns: minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .ws-app,
html.waypoint-fold-tablet[data-fold-layout="split"] .ws-app:has(.ws-rail.is-collapsed) {
  grid-template-columns: 168px minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet .ws-rail {
  display: none;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .ws-sidenav {
  display: flex;
}

html.waypoint-fold-tablet:not([data-fold-layout="split"]) .ws-sidenav {
  display: none;
}

html.waypoint-fold-tablet .ws-main {
  max-width: none;
  padding: 10px 12px 20px;
}

html.waypoint-fold-tablet .ws-app-header {
  grid-template-columns: 1fr auto;
  gap: 8px;
}

html.waypoint-fold-tablet .ws-pref-row,
html.waypoint-fold-tablet .ws-kyr-current {
  grid-template-columns: minmax(0, 1fr);
}

html.waypoint-fold-tablet .ws-kyr-dialog {
  width: min(720px, calc(100vw - 20px)) !important;
  max-height: calc(100dvh - 20px);
  overflow: auto;
}

/* ===== Captain's Log ===== */

html.waypoint-fold-tablet #executionJournalWindow:not([hidden]) {
  left: 8px !important;
  right: 8px !important;
  top: calc(var(--desk-header-h, 56px) + 8px) !important;
  width: auto !important;
  height: calc(100dvh - var(--desk-header-h, 56px) - 16px) !important;
  max-width: calc(100vw - 16px) !important;
  max-height: calc(100dvh - 16px) !important;
}

html.waypoint-fold-tablet .ej-titlebar,
html.waypoint-fold-tablet .ej-pete-btn,
html.waypoint-fold-tablet .ej-tabs button,
html.waypoint-fold-tablet [data-ej-cmd] {
  min-height: 44px;
}

html.waypoint-fold-tablet .ej-shell-content {
  overflow: auto;
}

/* ===== Training / Intel / Store / Development / Admin / News ===== */

html.waypoint-fold-tablet body.training-portal-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.competitive-intel-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.store-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.development-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.admin-hub-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.event-radar-mode .deck-persistent-shell {
  height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  padding: 8px 10px !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .training-grid,
html.waypoint-fold-tablet .store-category-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

html.waypoint-fold-tablet .development-view,
html.waypoint-fold-tablet .competitive-intel-view,
html.waypoint-fold-tablet .training-grid,
html.waypoint-fold-tablet .store-grid,
html.waypoint-fold-tablet .admin-hub-view {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

html.waypoint-fold-tablet .community-shell-layout {
  grid-template-columns: var(--nav-rail-w) minmax(0, 1fr);
  height: calc(100dvh - var(--desk-header-h, 56px));
  max-height: calc(100dvh - var(--desk-header-h, 56px));
}

html.waypoint-fold-tablet .account-shell {
  max-width: 100%;
  padding: 16px 12px 32px;
}

html.waypoint-fold-tablet .account-grid {
  grid-template-columns: minmax(0, 1fr);
}

/* ===== Modals / popups / docks ===== */

html.waypoint-fold-tablet .alert-overlay,
html.waypoint-fold-tablet .analysis-complete-overlay,
html.waypoint-fold-tablet .management-alert-overlay,
html.waypoint-fold-tablet .ws-crop-overlay,
html.waypoint-fold-tablet .ws-kyr-overlay,
html.waypoint-fold-tablet .pete-thesis-popup {
  padding: 12px;
  align-items: stretch;
}

html.waypoint-fold-tablet .analysis-complete-overlay > *,
html.waypoint-fold-tablet .alert-overlay > *,
html.waypoint-fold-tablet .management-alert-card,
html.waypoint-fold-tablet .pete-thesis-popup-card,
html.waypoint-fold-tablet .ws-kyr-dialog {
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  overflow: auto;
}

html.waypoint-fold-tablet .bloomberg-dock {
  max-width: min(420px, calc(100vw - 16px));
  right: 8px;
  bottom: calc(8px + var(--fold-safe-bottom));
}

html.waypoint-fold-tablet .pete-chat-messenger,
html.waypoint-fold-tablet .crew-messenger-window,
html.waypoint-fold-tablet [id^="crewMsg"],
html.waypoint-fold-tablet .pete-watch-live {
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - var(--desk-header-h, 56px) - 16px);
}

/* ===== Tables: internal scroll, not page scroll ===== */

html.waypoint-fold-tablet table {
  font-size: 0.82rem;
}

html.waypoint-fold-tablet .trade-table th,
html.waypoint-fold-tablet .trade-table td {
  white-space: nowrap;
}

/* ===== Typography ===== */

html.waypoint-fold-tablet .panel-title,
html.waypoint-fold-tablet .eyebrow {
  font-size: clamp(0.68rem, 1.6vw, 0.92rem);
}

html.waypoint-fold-tablet .pbs-brand-title {
  font-size: clamp(0.9rem, 2.4vw, 1.15rem);
}

/* ===== Narrow split-window: still Fold class only if detector kept it;
   extra stacking if width is tight within Fold range ===== */

html.waypoint-fold-tablet[data-fold-orient="portrait"] .quote-ticker-oil {
  display: none;
}

html.waypoint-fold-tablet .community-grid {
  grid-template-columns: minmax(0, 1fr);
  overflow: auto;
}

html.waypoint-fold-tablet[data-fold-layout="split"] .community-grid {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
}

html.waypoint-fold-tablet .discord-layout {
  grid-template-columns: minmax(0, 1fr);
  min-height: min(70dvh, 640px);
}

html.waypoint-fold-tablet .nd-layout-canvas {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

html.waypoint-fold-tablet .nd-win {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 200px;
  max-width: 100% !important;
}

html.waypoint-fold-tablet .nd-win-resize {
  display: none !important;
}

html.waypoint-fold-tablet .pete-watch-change-modal .pete-watch-change-card {
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  overflow: auto;
}

html.waypoint-fold-tablet .ah-desk-host .ah-layout-canvas,
html.waypoint-fold-tablet #adminDeskCanvas {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

html.waypoint-fold-tablet .ah-win {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 180px;
  max-width: 100% !important;
}

html.waypoint-fold-tablet .ah-win-resize {
  display: none !important;
}

html.waypoint-fold-tablet .admin-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

/* ===== Phone-tier override — Fold must stay side-rail command tablet ===== */

html.waypoint-fold-tablet.ui-tier-phone .command-deck-layout,
html[data-device-mode="fold-tablet"].ui-tier-phone .command-deck-layout {
  grid-template-columns: var(--nav-rail-w) minmax(0, 1fr) !important;
  padding-bottom: 0 !important;
}

html.waypoint-fold-tablet.ui-tier-phone .nav-rail,
html[data-device-mode="fold-tablet"].ui-tier-phone .nav-rail {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  z-index: auto !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  width: var(--nav-rail-w) !important;
  min-width: var(--nav-rail-w) !important;
  height: 100% !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  padding: 8px 4px calc(8px + var(--fold-safe-bottom)) !important;
  border-top: 0 !important;
  border-right: 1px solid rgba(201, 162, 39, 0.14) !important;
  background: transparent !important;
}

html.waypoint-fold-tablet.ui-tier-phone .nav-rail-brand {
  display: flex !important;
}

html.waypoint-fold-tablet.ui-tier-phone .nav-rail-btn {
  width: 48px !important;
  min-width: 48px !important;
  flex: 0 0 auto !important;
}

html.waypoint-fold-tablet.ui-tier-phone .deck-persistent-shell {
  padding-bottom: 10px !important;
}

/* Kill leftover absolute desk chrome / floating-window ghosts on Fold */
html.waypoint-fold-tablet .ad-win-chrome,
html.waypoint-fold-tablet .ad-win-controls,
html.waypoint-fold-tablet .ws-chrome-drag,
html.waypoint-fold-tablet .th-win-chrome {
  display: none !important;
}

html.waypoint-fold-tablet .ad-layout-canvas .ad-win {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border-radius: 10px;
}

html.waypoint-fold-tablet .ad-layout-toolbar .btn[data-ad-drag],
html.waypoint-fold-tablet [data-ad-drag] {
  cursor: default;
}

/* Dense Fold workspace — reduce empty center */
html.waypoint-fold-tablet body:not(.helm-mode):not(.trade-log-mode):not(.store-mode):not(.training-portal-mode):not(.competitive-intel-mode):not(.development-mode):not(.admin-hub-mode):not(.event-radar-mode):not(.social-mode) .deck-workspace {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

html.waypoint-fold-tablet .command-deck-layout > .deck-main,
html.waypoint-fold-tablet .deck-main {
  min-width: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* ===== Gate / login — stabilize Fold first paint (no desktop FOUC loop) ===== */

html.waypoint-fold-tablet #launchOverlay:not([hidden]) {
  min-height: 100svh;
  min-height: 100dvh;
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  overflow: hidden;
}

html.waypoint-fold-tablet .gate-cinematic,
html.waypoint-fold-tablet .gate-harbor-stage {
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
}

html.waypoint-fold-tablet .gate-cinematic.gate-harbor-idle .gate-harbor-stage {
  animation: none !important;
  transform: none !important;
}

html.waypoint-fold-tablet .gate-cinematic.gate-harbor-idle .gate-harbor-art {
  transform: scale(1) !important;
  object-fit: cover;
  object-position: 50% 42%;
  width: 100%;
  height: 100%;
  filter: brightness(1) saturate(1.05);
}

html.waypoint-fold-tablet #launchOverlay.gate-auth-visible::before {
  height: min(420px, 48dvh);
  animation: none;
  opacity: 1;
}

html.waypoint-fold-tablet .gate-auth-card {
  width: min(420px, calc(100vw - 28px));
  max-height: min(78dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin-inline: auto;
}

html.waypoint-fold-tablet .gate-phase-auth,
html.waypoint-fold-tablet .gate-auth-dock {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

html.waypoint-fold-tablet .gate-auth-lantern {
  display: none;
}

html.waypoint-fold-tablet .gate-boarding-zoom .gate-harbor-stage {
  animation: none !important;
  transform: scale(1.05) !important;
}

html.waypoint-fold-tablet .pete-brainscan-panel.is-expanded:not(.is-minimized) {
  left: max(6px, var(--fold-safe-left)) !important;
  right: max(6px, var(--fold-safe-right)) !important;
  top: max(6px, var(--fold-safe-top)) !important;
  bottom: max(6px, var(--fold-safe-bottom)) !important;
}

html.waypoint-fold-tablet .pete-brainscan-panel.is-expanded .pete-brainscan-stage {
  min-height: min(52dvh, 640px);
}

html.waypoint-fold-tablet .pbs-evo-dock .pbs-text-btn,
html.waypoint-fold-tablet .pbs-expand-btn,
html.waypoint-fold-tablet #peteBrainScanEvolve {
  min-height: 44px;
  min-width: 44px;
}

html.waypoint-fold-tablet .pbs-inspect {
  max-width: calc(100% - 20px);
  font-size: 0.7rem;
}

/* Film Room / Analysis Hub / Social — unfolded inner display is a tablet, not Admin Hub */
html.waypoint-fold-tablet body.film-room-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.admin-hub-mode.film-room-mode .deck-persistent-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  overflow: hidden !important;
  padding: 6px 8px 8px !important;
}

html.waypoint-fold-tablet body.film-room-mode .film-room-shell,
html.waypoint-fold-tablet body.film-room-mode #viewFilmRoom.film-room-shell:not([hidden]),
html.waypoint-fold-tablet body.film-room-mode .film-room-root {
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: auto !important;
}

html.waypoint-fold-tablet body.analysis-mode .deck-persistent-shell {
  overflow: hidden !important;
}

html.waypoint-fold-tablet body.analysis-mode .ad-desk-host,
html.waypoint-fold-tablet body.analysis-mode .ad-layout-canvas {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
}

html.waypoint-fold-tablet body.social-mode .deck-persistent-shell {
  overflow: hidden !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet body.social-mode .ws-app {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 100% !important;
}

/* ===== Fold inner screen: one scroll column, no overlapping desktop windows =====
   Later desktop layout sheets use equal specificity; these !important rules keep
   the unfolded tablet usable (TradingView-style: stack + scroll). */

html.waypoint-fold-tablet .command-deck-layout {
  height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 56px)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .deck-main,
html.waypoint-fold-tablet .command-deck-layout > .deck-main {
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain;
}

html.waypoint-fold-tablet .deck-persistent-shell,
html.waypoint-fold-tablet body.analysis-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.ad-full-desk .deck-persistent-shell,
html.waypoint-fold-tablet body.analysis-mode.ad-full-desk .deck-persistent-shell,
html.waypoint-fold-tablet body.trade-log-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.helm-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.social-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.film-room-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.training-portal-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.competitive-intel-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.store-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.development-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.admin-hub-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.event-radar-mode .deck-persistent-shell {
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html.waypoint-fold-tablet .ad-desk-host,
html.waypoint-fold-tablet body.analysis-mode .ad-desk-host:not([hidden]),
html.waypoint-fold-tablet body.ad-full-desk .ad-desk-host,
html.waypoint-fold-tablet .ad-layout-canvas,
html.waypoint-fold-tablet body.th-layout-active .th-layout-canvas,
html.waypoint-fold-tablet .th-layout-canvas,
html.waypoint-fold-tablet .nd-layout-canvas,
html.waypoint-fold-tablet .ah-desk-host .ah-layout-canvas,
html.waypoint-fold-tablet #adminDeskCanvas,
html.waypoint-fold-tablet #analysisDeskCanvas,
html.waypoint-fold-tablet #tradeHubLayoutCanvas,
html.waypoint-fold-tablet #newsDeskCanvas {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 0 0 auto !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
  gap: 8px !important;
}

html.waypoint-fold-tablet .ad-win,
html.waypoint-fold-tablet .th-win,
html.waypoint-fold-tablet .nd-win,
html.waypoint-fold-tablet .ah-win {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 160px;
  transform: none !important;
  z-index: auto !important;
}

html.waypoint-fold-tablet .ad-win[data-layout-id="chart"],
html.waypoint-fold-tablet .th-win[data-layout-id="chart"] {
  min-height: min(48dvh, 520px);
}

html.waypoint-fold-tablet body.helm-mode .helm-layout,
html.waypoint-fold-tablet body.helm-mode .helm-dashboard,
html.waypoint-fold-tablet body.helm-mode .helm-shell {
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: none !important;
}

html.waypoint-fold-tablet body.helm-mode .helm-chart-eye,
html.waypoint-fold-tablet body.helm-mode .helm-side-stack,
html.waypoint-fold-tablet body.helm-mode .helm-command-bar,
html.waypoint-fold-tablet body.helm-mode .helm-broker-panel,
html.waypoint-fold-tablet body.helm-mode .helm-journal-panel {
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html.waypoint-fold-tablet body.trade-log-mode .trade-hub-shell,
html.waypoint-fold-tablet body.trade-log-mode .mc-paper-futures-deck,
html.waypoint-fold-tablet .development-view,
html.waypoint-fold-tablet .competitive-intel-view,
html.waypoint-fold-tablet .admin-hub-view,
html.waypoint-fold-tablet .training-grid,
html.waypoint-fold-tablet .store-grid,
html.waypoint-fold-tablet body.film-room-mode .film-room-shell,
html.waypoint-fold-tablet body.film-room-mode .film-room-root,
html.waypoint-fold-tablet body.social-mode .ws-main {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

html.waypoint-fold-tablet .ws-app {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html.waypoint-fold-tablet .ad-win-body,
html.waypoint-fold-tablet .th-win-body,
html.waypoint-fold-tablet .nd-win-body {
  min-height: 0;
  overflow: visible;
}

/* Opening harbor: ID-qualified so Fold beats gate-boarding.css zoom (which glitches on load) */
html.waypoint-fold-tablet #launchOverlay .gate-harbor-stage,
html.waypoint-fold-tablet #launchOverlay.gate-boarding-zoom .gate-harbor-stage,
html.waypoint-fold-tablet #launchOverlay.gate-boarding-active .gate-harbor-stage {
  animation: none !important;
  transform: none !important;
  filter: none !important;
}

html.waypoint-fold-tablet #launchOverlay .gate-harbor-art,
html.waypoint-fold-tablet #launchOverlay.gate-boarding-zoom .gate-harbor-art {
  transform: none !important;
  object-fit: cover !important;
  object-position: 50% 42% !important;
  animation: none !important;
}

html.waypoint-fold-tablet #launchOverlay.gate-boarding-enter,
html.waypoint-fold-tablet #launchOverlay.gate-boarding-enter.gate-boarding-active {
  animation: none !important;
}

html.waypoint-fold-tablet #launchOverlay .gate-ship-rock,
html.waypoint-fold-tablet #launchOverlay .gate-light-sweep,
html.waypoint-fold-tablet #launchOverlay .gate-lantern-pulse {
  animation: none !important;
}

html.waypoint-fold-tablet #launchOverlay.gate-auth-visible::before {
  animation: none !important;
}

/* ===== Inner Fold compact tablet terminal (wins over earlier Fold rules) ===== */

html.waypoint-fold-tablet .nav-rail-btn,
html.waypoint-fold-tablet .nav-rail-btn-labeled,
html.waypoint-fold-tablet .nav-rail-btn-pirate {
  width: 44px;
  min-width: 44px;
  min-height: 40px;
}

html.waypoint-fold-tablet .desk-header {
  --desk-header-h: 48px;
}

html.waypoint-fold-tablet body:not(.helm-mode):not(.trade-log-mode):not(.store-mode):not(.training-portal-mode):not(.competitive-intel-mode):not(.development-mode):not(.admin-hub-mode):not(.event-radar-mode):not(.social-mode) .deck-persistent-shell,
html.waypoint-fold-tablet[data-fold-layout="split"] body:not(.helm-mode):not(.trade-log-mode):not(.store-mode):not(.training-portal-mode):not(.competitive-intel-mode):not(.development-mode):not(.admin-hub-mode):not(.event-radar-mode):not(.social-mode) .deck-persistent-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1.3fr) minmax(200px, 0.85fr) !important;
  height: calc(100dvh - var(--desk-header-h, 48px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 48px)) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  gap: 8px !important;
  padding: 6px 8px 8px !important;
}

html.waypoint-fold-tablet body.analysis-mode.ad-full-desk .deck-persistent-shell,
html.waypoint-fold-tablet body.analysis-mode .deck-persistent-shell {
  height: calc(100dvh - var(--desk-header-h, 48px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 48px)) !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .ad-desk-host,
html.waypoint-fold-tablet body.analysis-mode .ad-desk-host:not([hidden]),
html.waypoint-fold-tablet body.ad-full-desk .ad-desk-host {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

html.waypoint-fold-tablet .ad-layout-canvas,
html.waypoint-fold-tablet #analysisDeskCanvas {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: start !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  max-height: 100% !important;
}

html.waypoint-fold-tablet .ad-win[data-layout-id="chart"] {
  grid-column: 1 / -1;
  min-height: min(38dvh, 360px);
}

html.waypoint-fold-tablet body.admin-hub-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .deck-persistent-shell {
  height: calc(100dvh - var(--desk-header-h, 48px)) !important;
  max-height: calc(100dvh - var(--desk-header-h, 48px)) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .admin-hub-shell,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .admin-app-embedded,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .ah-desk-host:not([hidden]) {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .ah-desk-host .ah-layout-canvas,
html.waypoint-fold-tablet #adminDeskCanvas {
  display: grid !important;
  grid-template-columns: minmax(148px, 200px) minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
  gap: 8px !important;
}

html.waypoint-fold-tablet #adminDeskCanvas:has(.ah-win[data-layout-id="peteNav"]:not([hidden])) {
  grid-template-columns: minmax(128px, 0.22fr) minmax(128px, 0.22fr) minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet .ah-win {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .ah-win[data-layout-id="nav"] {
  grid-column: 1;
  grid-row: 1;
}

html.waypoint-fold-tablet .ah-win[data-layout-id="main"] {
  grid-column: 2;
  grid-row: 1;
}

html.waypoint-fold-tablet #adminDeskCanvas:has(.ah-win[data-layout-id="peteNav"]:not([hidden])) .ah-win[data-layout-id="peteNav"] {
  grid-column: 2;
  grid-row: 1;
}

html.waypoint-fold-tablet #adminDeskCanvas:has(.ah-win[data-layout-id="peteNav"]:not([hidden])) .ah-win[data-layout-id="main"] {
  grid-column: 3;
  grid-row: 1;
}

html.waypoint-fold-tablet .ah-win-body,
html.waypoint-fold-tablet .ah-win-body > .admin-sections,
html.waypoint-fold-tablet .ah-win-body > .admin-section-nav,
html.waypoint-fold-tablet .ah-win-body > .everything-pete-nav {
  min-height: 0 !important;
  height: 100% !important;
  overflow: auto !important;
}

html.waypoint-fold-tablet .admin-hub-view {
  overflow: auto !important;
  height: 100% !important;
  max-height: none !important;
}

html.waypoint-fold-tablet .panel-title,
html.waypoint-fold-tablet .eyebrow {
  font-size: clamp(0.62rem, 1.4vw, 0.82rem);
}

/* ===== Inner Fold: visual viewport, not 100dvh (Chrome chrome + Android taskbar) =====
   Earlier Fold rules fight each other (overflow:hidden + height:100% collapse).
   These last-wins rules size to --fold-vh/--fold-vw from visualViewport. */

html.waypoint-fold-tablet,
html[data-device-mode="fold-tablet"] {
  --fold-vvh: var(--fold-vh, 100dvh);
  --fold-vvw: var(--fold-vw, 100vw);
}

html.waypoint-fold-tablet .command-deck-layout,
html.waypoint-fold-tablet.ui-tier-phone .command-deck-layout {
  height: calc(var(--fold-vvh) - var(--desk-header-h, 48px)) !important;
  max-height: calc(var(--fold-vvh) - var(--desk-header-h, 48px)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .deck-main,
html.waypoint-fold-tablet .command-deck-layout > .deck-main {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-bottom: calc(16px + var(--fold-safe-bottom, 0px)) !important;
}

/* LOGIN — keep the form inside the visible overlay; never clip Email/password */
html.waypoint-fold-tablet #launchOverlay:not([hidden]) {
  top: var(--fold-vt, 0px) !important;
  left: var(--fold-vl, 0px) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--fold-vvw) !important;
  height: var(--fold-vvh) !important;
  max-height: var(--fold-vvh) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet #launchOverlay.gate-auth-visible::before {
  height: min(280px, 36%) !important;
  z-index: 1 !important;
  pointer-events: none !important;
}

html.waypoint-fold-tablet .gate-phase-auth,
html.waypoint-fold-tablet .gate-phase-auth.gate-phase-visible,
html.waypoint-fold-tablet .gate-phase-auth.gate-auth-login {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  top: 50% !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: min(400px, calc(var(--fold-vvw) - 24px)) !important;
  max-height: calc(var(--fold-vvh) - 24px) !important;
  overflow: visible !important;
  animation: none !important;
  filter: none !important;
  opacity: 1 !important;
  z-index: 30 !important;
}

html.waypoint-fold-tablet .gate-auth-card {
  width: 100% !important;
  max-height: calc(var(--fold-vvh) - 120px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 14px 16px 18px !important;
}

html.waypoint-fold-tablet .gate-explore-lantern {
  margin-top: 10px !important;
  min-height: 44px !important;
}

html.waypoint-fold-tablet .gate-legal {
  margin-top: 8px !important;
  font-size: 0.52rem !important;
  padding-bottom: 4px !important;
}

html.waypoint-fold-tablet .gate-form-panel.active,
html.waypoint-fold-tablet #gateLoginPanel.active,
html.waypoint-fold-tablet #gateLoginForm {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

html.waypoint-fold-tablet .gate-form-panel label {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 4px !important;
}

html.waypoint-fold-tablet .gate-form-panel input,
html.waypoint-fold-tablet #gateLoginEmail,
html.waypoint-fold-tablet #gateLoginPassword {
  display: block !important;
  width: 100% !important;
  min-height: 44px !important;
  height: 44px !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: 16px !important;
  color: #eef4fa !important;
  background: rgba(4, 10, 18, 0.95) !important;
  border: 1px solid rgba(197, 160, 89, 0.4) !important;
  padding: 8px 10px !important;
}

html.waypoint-fold-tablet .gate-form-panel .btn,
html.waypoint-fold-tablet #gateLoginForm .btn {
  min-height: 44px !important;
  width: 100% !important;
}

/* STANDALONE /admin — two-column shell, main pane scrolls */
html.waypoint-fold-tablet .community-shell-layout,
html.waypoint-fold-tablet.admin-portal-body .community-shell-layout,
html.waypoint-fold-tablet body.admin-portal-body .community-shell-layout {
  display: grid !important;
  grid-template-columns: var(--nav-rail-w, 52px) minmax(0, 1fr) !important;
  width: 100% !important;
  height: var(--fold-vvh) !important;
  max-height: var(--fold-vvh) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html.waypoint-fold-tablet .community-shell-layout > .nav-rail {
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
}

html.waypoint-fold-tablet .community-main-area,
html.waypoint-fold-tablet .admin-portal-wrap,
html.waypoint-fold-tablet #adminApp:not([hidden]),
html.waypoint-fold-tablet #adminGate:not([hidden]) {
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
}

html.waypoint-fold-tablet .community-main-area {
  height: 100% !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

html.waypoint-fold-tablet #adminApp:not([hidden]) {
  display: block !important;
}

html.waypoint-fold-tablet #adminGate:not([hidden]) {
  display: grid !important;
  min-height: 100% !important;
}

html.waypoint-fold-tablet .admin-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  height: auto !important;
  min-height: 0 !important;
}

html.waypoint-fold-tablet .admin-section-nav,
html.waypoint-fold-tablet .everything-pete-nav {
  position: static !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  overflow: auto !important;
}

html.waypoint-fold-tablet .admin-section-nav button {
  min-height: 40px !important;
  flex: 0 0 auto !important;
}

/* EMBEDDED Admin Hub — in-flow stack, never a 0-height window canvas */
html.waypoint-fold-tablet body.admin-hub-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .deck-persistent-shell,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .admin-hub-shell,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .admin-app-embedded,
html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .ah-desk-host:not([hidden]) {
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
  flex: 0 0 auto !important;
}

html.waypoint-fold-tablet .ah-layout-toolbar {
  display: none !important;
}

html.waypoint-fold-tablet .ah-desk-host .ah-layout-canvas,
html.waypoint-fold-tablet #adminDeskCanvas {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
  gap: 8px !important;
}

html.waypoint-fold-tablet .ah-win,
html.waypoint-fold-tablet #adminDeskCanvas .ah-win {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 120px !important;
  max-height: none !important;
  overflow: visible !important;
}

html.waypoint-fold-tablet .ah-win-body,
html.waypoint-fold-tablet .ah-win-body > .admin-sections,
html.waypoint-fold-tablet .ah-win-body > .admin-section-nav,
html.waypoint-fold-tablet .ah-win-body > .everything-pete-nav {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

html.waypoint-fold-tablet body.admin-hub-mode.ah-full-desk .ah-layout-absorbed {
  display: none !important;
}

/* HUB — allow the mission-control column to scroll; don't clip account rows */
html.waypoint-fold-tablet body.trade-log-mode .deck-persistent-shell,
html.waypoint-fold-tablet body.trade-log-mode .trade-hub-shell,
html.waypoint-fold-tablet body.trade-log-mode .mc-paper-futures-deck,
html.waypoint-fold-tablet body.trade-log-mode .mission-control-deck,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-top,
html.waypoint-fold-tablet body.trade-log-mode .mc-row-tables,
html.waypoint-fold-tablet body.trade-log-mode .mission-control-deck .panel,
html.waypoint-fold-tablet body.trade-log-mode .mission-control-deck .helm-panel {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

html.waypoint-fold-tablet body.trade-log-mode .mc-row-top {
  grid-template-columns: minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet[data-fold-layout="split"] body.trade-log-mode .mc-row-top {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
}

html.waypoint-fold-tablet .desk-header {
  flex-wrap: wrap !important;
  max-width: 100% !important;
}

html.waypoint-fold-tablet #openMyAccountLabel,
html.waypoint-fold-tablet .execution-journal-open-tip,
html.waypoint-fold-tablet .pete-brainscan-open-tip {
  display: none !important;
}

html.waypoint-fold-tablet .pete-chat-messenger {
  bottom: calc(12px + var(--fold-safe-bottom, 0px)) !important;
  right: 8px !important;
}

html.waypoint-fold-tablet .pete-chat-messenger:not(.is-open) {
  z-index: 80;
}

/* BrainScan — keep chrome in flow so TREND ENTRY / close no longer overlap */
html.waypoint-fold-tablet .pete-brainscan-panel:not(.is-minimized),
html.waypoint-fold-tablet .pete-brainscan-panel.is-expanded:not(.is-minimized) {
  left: calc(var(--nav-rail-w, 52px) + 6px) !important;
  right: 6px !important;
  top: calc(var(--desk-header-h, 48px) + 6px) !important;
  bottom: calc(6px + var(--fold-safe-bottom, 0px)) !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
}

html.waypoint-fold-tablet .pete-brainscan-panel.is-expanded .pbs-head-identity,
html.waypoint-fold-tablet .pete-brainscan-panel.is-expanded .pbs-head-actions {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
}

html.waypoint-fold-tablet .pbs-head-row,
html.waypoint-fold-tablet .pbs-head-actions,
html.waypoint-fold-tablet .pbs-quality {
  flex-wrap: wrap !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

html.waypoint-fold-tablet .pbs-text-btn,
html.waypoint-fold-tablet .pbs-cta {
  flex: 0 1 auto !important;
  max-width: 100% !important;
}

html.waypoint-fold-tablet .pbs-close {
  position: relative !important;
  margin-left: auto;
}

html.waypoint-fold-tablet .panel-title,
html.waypoint-fold-tablet .eyebrow {
  font-size: clamp(0.62rem, 1.4vw, 0.82rem);
}

html.waypoint-fold-tablet .admin-founder-tools-row,
[data-device-mode="fold-tablet"] .admin-founder-tools-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

html.waypoint-fold-tablet .admin-founder-tools-row .pm-admin-chip,
[data-device-mode="fold-tablet"] .admin-founder-tools-row .pm-admin-chip {
  min-height: 44px;
  width: 100%;
}

html.waypoint-fold-tablet body.pm-charts-open #waypointChartsOverlay,
[data-device-mode="fold-tablet"] body.pm-charts-open #waypointChartsOverlay {
  width: 100%;
  height: min(78vh, 720px);
  max-width: 100%;
  overflow-x: hidden;
}
html.waypoint-fold-tablet body.pm-charts-open .wp-charts-canvas,
[data-device-mode="fold-tablet"] body.pm-charts-open .wp-charts-canvas {
  min-height: 180px;
}
html.waypoint-fold-tablet #waypointChartsOverlay.is-tile-max,
[data-device-mode="fold-tablet"] #waypointChartsOverlay.is-tile-max,
html.waypoint-fold-tablet body.pm-charts-open #waypointChartsOverlay.is-tile-max,
[data-device-mode="fold-tablet"] body.pm-charts-open #waypointChartsOverlay.is-tile-max {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
}
html.waypoint-fold-tablet #waypointChartsOverlay.is-tile-max .wp-charts-tile.is-max .wp-charts-canvas,
[data-device-mode="fold-tablet"] #waypointChartsOverlay.is-tile-max .wp-charts-tile.is-max .wp-charts-canvas {
  min-height: min(72dvh, 900px);
}

/* Desktop lock reminder: no unscoped rules below this file should be added
   without html.waypoint-fold-tablet. Laptop 1280–3440 remains on viewport.css. */
