/* Mobile terminal navigation. Load after terminal-refinement.css.
   The desktop grid and transaction logic are unchanged. Pane visibility is
   owned here; mobile-terminal.js only updates the data attributes and focus. */
.mobile-bottom-nav,
.mobile-market-tabs,
.mobile-market-trades,
.mobile-account-heading,
.mobile-ticket-heading { display: none; }

@media (max-width: 980px) {
  body.hl-site.terminal-mobile-active {
    --terminal-nav-height: calc(52px + env(safe-area-inset-top, 0px));
    --mobile-nav-height: 56px;
    --mobile-bottom-space: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    --mobile-view-height: max(0px, calc(var(--terminal-viewport-height, 100dvh) - var(--terminal-nav-height) - var(--mobile-bottom-space)));
    height: auto !important;
    max-height: none !important;
    min-width: 0;
    max-width: 100%;
    overflow: visible !important;
    background: var(--terminal-bg, #0f1a1f);
    color: var(--terminal-text, #edf6f5);
    -webkit-text-size-adjust: 100%;
  }

  body.hl-site.terminal-mobile-active .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 env(safe-area-inset-right, 0px) var(--mobile-bottom-space) env(safe-area-inset-left, 0px) !important;
    box-sizing: border-box;
    overflow: visible !important;
    background: var(--terminal-bg, #0f1a1f) !important;
  }

  /* A 44px menu button on the left; brand and wallet action share one row. */
  body.hl-site.terminal-mobile-active .nav {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    height: var(--terminal-nav-height) !important;
    min-height: var(--terminal-nav-height) !important;
    padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)) !important;
    gap: 10px !important;
    box-sizing: border-box;
    border-bottom: 1px solid var(--terminal-border, #293940);
    background: var(--terminal-bg, #0f1a1f);
  }
  body.hl-site.terminal-mobile-active .nav-toggle {
    order: 0;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px !important;
    min-height: 44px;
    padding: 0 !important;
    border: 1px solid var(--terminal-border, #293940) !important;
    border-radius: 6px;
    background: transparent !important;
    color: var(--terminal-text, #edf6f5) !important;
  }
  body.hl-site.terminal-mobile-active .nav-toggle[aria-expanded="true"] { background: var(--terminal-surface, #142127) !important; }
  body.hl-site.terminal-mobile-active .nav .brand {
    order: 1;
    flex: 1 1 auto;
    gap: 6px;
    min-width: 0;
    min-height: 44px;
    margin: 0;
  }
  body.hl-site.terminal-mobile-active .nav .brand > svg { flex: none; width: 22px; height: 22px; }
  body.hl-site.terminal-mobile-active .nav .brand > span { font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.hl-site.terminal-mobile-active .nav-right { order: 2; flex: none; gap: 0 !important; margin-left: auto; }
  body.hl-site.terminal-mobile-active .nav #connectBtn {
    min-width: 84px;
    max-width: 36vw;
    height: 44px !important;
    min-height: 44px;
    padding: 0 12px !important;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.hl-site.terminal-mobile-active .nav-links.open {
    top: var(--terminal-nav-height);
    max-height: calc(var(--terminal-viewport-height, 100dvh) - var(--terminal-nav-height) - var(--mobile-bottom-space));
    padding-bottom: 12px;
  }

  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] {
    /* Resolve this on the element where the controller sets viewport height. */
    --mobile-view-height: max(0px, calc(var(--terminal-viewport-height, 100dvh) - var(--terminal-nav-height) - var(--mobile-bottom-space)));
    display: flex !important;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto !important;
    min-height: var(--mobile-view-height) !important;
    padding: 0;
    gap: 0;
    overflow: visible !important;
    background: var(--terminal-bg);
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] > .mobile-desk-tabs { display: none !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .terminal-side { display: contents !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .terminal-chart {
    display: flex !important;
    flex: none;
    flex-direction: column;
    order: 0;
    width: 100%;
    min-width: 0;
    min-height: 0 !important;
    height: auto;
    overflow: visible !important;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(.hl-book, .hl-ticket, .hl-account, .terminal-bottom, .mobile-market-trades) {
    display: none !important;
    flex: none;
    order: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
    background: var(--terminal-bg);
  }

  /* Keep the same selected-model nodes visible in Markets and Trade. */
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(84px, 30%);
    align-items: center;
    gap: 10px;
    min-height: 76px;
    padding: 10px 14px;
    box-sizing: border-box;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-head .pair-btn {
    min-width: 0;
    min-height: 44px;
    gap: 8px;
    align-items: center;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-av { width: 28px; height: 28px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-names { min-width: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-head .dex-pair { display: block; min-width: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #pairLabel {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-quote { display: inline-block; margin-top: 3px; font-size: 11px; line-height: 1.2; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .pair-chevron { padding: 0; font-size: 15px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-meta { display: none !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-stats {
    display: block;
    min-width: 0;
    width: 100%;
    margin: 0;
    text-align: right;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-stat:not(.dex-price) { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-price { display: grid; gap: 4px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-price > span { font-size: 11px; line-height: 1.25; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-price strong { font-size: clamp(16px, 4.4vw, 20px); line-height: 1.2; font-weight: 500; overflow-wrap: anywhere; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .price-feed-state:not([hidden]) { margin: 3px 0 0 3px; font-size: 10px; }

  /* Markets has its own read-only chart / overview / transactions switch. */
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"] #mobileMarketTabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex: none;
    width: 100%;
    min-height: 44px;
    padding: 0;
    gap: 0;
    border-bottom: 1px solid var(--terminal-border);
    background: var(--terminal-bg);
  }
  body.hl-site.terminal-mobile-active #mobileMarketTabs button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--terminal-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
    cursor: pointer;
  }
  body.hl-site.terminal-mobile-active #mobileMarketTabs button[aria-selected="true"] { border-bottom-color: var(--terminal-accent); color: var(--terminal-text); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"]:not([data-mobile-view="markets"]) #mobileMarketTabs,
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"]:not([data-mobile-view="markets"]) :is(#chartBox, #chartTools, #chartAlt, .tv-ranges),
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"]:not([data-market-panel="chart"]) :is(#chartBox, #chartTools, #chartAlt, .tv-ranges) { display: none !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="chart"] #chartTools:not([hidden]) {
    display: flex !important;
    flex: none;
    height: 28px;
    min-height: 28px;
    padding: 0 14px;
    align-items: center;
    box-sizing: border-box;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #chartTools .legend {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: var(--terminal-muted);
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #chartBox {
    flex: none;
    height: clamp(220px, calc(var(--mobile-view-height) - 380px), 420px);
    min-height: 220px;
    max-height: none;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .tv-ranges { height: 48px; min-height: 48px; padding: 0 6px; box-sizing: border-box; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .tv-ranges button { height: 44px; min-height: 44px; min-width: 44px; padding: 0 10px; font-size: 13px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .tv-ranges .tv-tz { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .terminal-chart-state { padding: 24px 16px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="overview"] .hl-book { display: block !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="overview"] .dex-head { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="overview"] .dex-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; text-align: left; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="overview"] .dex-stat { display: grid; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="overview"] .dex-meta { display: flex !important; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .hl-book-tabs { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .hl-book-body { overflow: visible; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-win { padding: 10px 12px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(.dex-flow, .dex-pool) { padding: 12px 16px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"][data-market-panel="trades"] #mobileMarketTrades { display: block !important; }

  /* The live ticket and its history DOM stay mounted across every tab switch. */
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .terminal-side {
    display: grid !important;
    grid-template-columns: minmax(0, 1.08fr) minmax(168px, 0.92fr);
    align-items: start;
    order: 1;
    width: 100%;
    min-width: 0;
    background: var(--terminal-bg);
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .hl-ticket { display: block !important; grid-column: 1; grid-row: 1; width: auto; min-width: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .hl-book {
    display: flex !important;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    max-height: 560px;
    overflow: auto;
    border-left: 1px solid var(--terminal-border);
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .hl-account { display: none !important; grid-row: 2; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.hl-book-tabs, .hl-book-body) { display: none !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] #mobileLiquidity { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: auto; color: var(--terminal-text); font-size: 11px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.liq-head, .liq-row) { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 22px; padding: 0 8px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .liq-head { min-height: 28px; color: var(--terminal-muted); border-bottom: 1px solid var(--terminal-border); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .liq-row span { min-width: 0; color: var(--terminal-muted); white-space: nowrap; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .liq-row strong { min-width: 0; overflow: hidden; color: var(--terminal-text); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.dex-flow, .dex-pool) { padding: 4px 8px; gap: 0; font-size: 11px; }

  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .dex-windows { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.dex-flow-top, .dex-split) { display: flex; flex-direction: column; gap: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.dex-flow-top > div, .dex-split > div, .dex-pool-row) { display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; min-width: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.dex-flow span, .dex-flow strong, .dex-pool-row > span, .dex-pool-row strong) { overflow-wrap: normal; word-break: normal; white-space: nowrap; text-overflow: ellipsis; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .terminal-stat-note { white-space: normal; overflow-wrap: break-word; font-size: 10px; line-height: 1.35; }

  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] :is(.dex-flow-top > div, .dex-split > div, .dex-pool-row) { min-height: 20px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="markets"] .terminal-bottom,
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="trade"] .terminal-bottom {
    display: flex !important;
    flex-direction: column;
    order: 3;
    width: 100%;
    border-top: 1px solid var(--terminal-border);
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #bottomTabs {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    position: static;
    top: auto;
    height: 40px;
    min-height: 40px;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #bottomTabs::-webkit-scrollbar { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #bottomTabs button {
    flex: 0 0 auto;
    height: 40px;
    min-height: 40px;
    padding: 0 12px;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-size: 13px;
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #bottomTabs button.on {
    border-bottom-color: var(--terminal-accent);
    color: var(--terminal-text);
  }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .mobile-ticket-heading { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry { padding: 14px 16px 16px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .seg { padding: 3px; gap: 4px; border-radius: 7px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .seg button { min-height: 44px; padding: 8px 10px; font-size: 14px; font-weight: 500; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .avail { margin-top: 10px; font-size: 13px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .field { margin-top: 12px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .inp { min-height: 46px; padding: 0 12px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .inp input { min-width: 0; min-height: 44px; padding: 10px 0; font-size: 16px !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .inp .unit { max-width: 46%; margin-left: 8px; font-size: 12px; overflow-wrap: anywhere; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .pcts { gap: 6px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .pcts button { min-height: 44px; padding: 6px 4px; font-size: 13px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .size-slider { height: 24px; margin: 8px 0 4px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry .quote { margin-top: 12px; padding-top: 10px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #entry :is(#sendBtn, #deskConnect) { min-height: 48px !important; height: 48px !important; margin-top: 6px; font-size: 16px !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #bottomTabs { top: var(--terminal-nav-height); min-height: 44px; height: 44px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #bottomTabs button { min-height: 44px; height: 44px; padding: 0 12px; font-size: 13px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(#bottomBody, #mobileTradesBody) { min-width: 0; max-width: 100%; padding: 12px 16px 20px; overflow-x: visible; box-sizing: border-box; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(#bottomBody, #mobileTradesBody) .tbl-wrap { display: block; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border: 0; border-radius: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(#bottomBody, #mobileTradesBody) .tbl { width: 100%; min-width: 640px; border: 0; font-size: 13px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #mobileTradesBody .tbl :is(th, td) { padding: 10px 8px; border-bottom: 1px solid var(--terminal-border); font-variant-numeric: tabular-nums; white-space: nowrap; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #mobileTradesBody .tbl th { background: var(--terminal-surface); color: var(--terminal-muted); font-weight: 400; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(#bottomBody, #mobileTradesBody) .terminal-table-state { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; min-height: 96px; padding: 16px 0; width: 100%; min-width: 0; box-sizing: border-box; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #mobileTradesBody > .note { color: var(--terminal-muted); font-size: 12px; line-height: 1.5; }

  /* Account actions stay near the bottom without covering long balances/content. */
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="account"] .terminal-chart { display: none !important; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"][data-mobile-view="account"] .hl-account { display: flex !important; flex-direction: column; min-height: var(--mobile-view-height); padding: 20px 16px 16px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .mobile-account-heading { display: block; margin: 0 0 24px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .mobile-account-heading h2 { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 500; color: var(--terminal-text); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .mobile-account-heading p { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--terminal-muted); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #mobileAccountModel { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--terminal-muted); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .acct-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto); min-height: 40px; gap: 12px; font-size: 14px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctSummaryBody { padding-bottom: 16px; border-bottom: 1px solid var(--terminal-border); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctActions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: auto; padding: 24px 0 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctActions :is(.primary, .ghost) { min-width: 0; min-height: 48px; padding: 10px 12px; border: 1px solid var(--terminal-input-border); border-radius: 7px; font-size: 14px; line-height: 1.3; text-align: center; color: var(--terminal-text); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctActions .primary:not(:disabled) { border-color: var(--terminal-accent); background: var(--terminal-accent); color: var(--terminal-accent-ink); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctActions :disabled { background: var(--terminal-raised); color: var(--terminal-muted); opacity: 1; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctAnn { margin-top: 8px; padding: 0; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #acctAnn a { min-height: 44px; padding: 8px; font-size: 12px; }

  /* Flat, full-width navigation matches the reference's inline icon + label. */
  body.hl-site.terminal-mobile-active #mobileBottomNav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: fixed;
    z-index: 50;
    inset: auto 0 0;
    width: 100%;
    height: var(--mobile-bottom-space);
    min-height: var(--mobile-bottom-space);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    box-sizing: border-box;
    gap: 0;
    border-top: 1px solid var(--terminal-border);
    background: var(--terminal-bg);
    color: var(--terminal-text);
  }
  body.hl-site.terminal-mobile-active #mobileBottomNav button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 44px;
    height: 100%;
    margin: 0;
    padding: 0 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--terminal-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  body.hl-site.terminal-mobile-active #mobileBottomNav button svg { flex: none; width: 21px; height: 21px; }
  body.hl-site.terminal-mobile-active #mobileBottomNav button[aria-selected="true"] { color: var(--terminal-accent); }
  body.hl-site.terminal-mobile-active :is(#mobileBottomNav, #mobileMarketTabs) button:focus-visible { outline: 2px solid var(--terminal-accent); outline-offset: -4px; }
  body.hl-site.terminal-mobile-active .toasts { bottom: calc(var(--mobile-bottom-space) + 12px); z-index: 90; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .pair-picker { z-index: 100; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .pair-picker-panel { max-height: var(--terminal-viewport-height, 100dvh); }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .pair-picker-head input { font-size: 16px; }
  body.hl-site.terminal-mobile-active.pair-picker-open #mobileBottomNav { visibility: hidden; pointer-events: none; }

  /* The virtual keyboard owns the lower screen. Keep editable content scrollable. */
  body.hl-site.terminal-mobile-active.mobile-keyboard-open { --mobile-bottom-space: 0px; }
  body.hl-site.terminal-mobile-active.mobile-keyboard-open #mobileBottomNav { display: none !important; }
  body.hl-site.terminal-mobile-active.mobile-keyboard-open .main { padding-bottom: 12px !important; }
  body.hl-site.terminal-mobile-active.mobile-keyboard-open .toasts { bottom: 12px; }
}

@media (max-width: 359px) {
  body.hl-site.terminal-mobile-active .nav { gap: 8px !important; }
  body.hl-site.terminal-mobile-active .nav .brand b { display: none; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-head { padding-inline: 12px; gap: 8px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] .dex-av { width: 24px; height: 24px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] #pairLabel { font-size: 13px; }
  body.hl-site.terminal-mobile-active .models-trade-desk[data-mobile-ready="true"] :is(#entry, #bottomBody, #mobileTradesBody, .hl-account) { padding-inline: 12px; }
  body.hl-site.terminal-mobile-active #mobileBottomNav button { gap: 6px; font-size: 13px; }
}
