/* Mobile-only layout adjustments. Desktop styles remain untouched. */
@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  img, svg, canvas, video { max-width: 100%; }
  input, select, textarea, button { max-width: 100%; }

  /* Public landing page */
  .wrap { width: calc(100% - 28px); }
  .promo-inner { gap: 8px; }
  .promo-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-inner { min-width: 0; }
  .brand { flex: 0 0 auto; }
  .auth-actions { position: absolute; top: 50%; right: 50px; display: flex !important; gap: 5px; transform: translateY(-50%); }
  .auth-actions .auth-login, .auth-actions .auth-register { display: inline-flex !important; min-height: 36px; align-items: center; justify-content: center; padding: 0 8px; font-size: 11px; white-space: nowrap; }
  .auth-actions .auth-register { max-width: 100px; overflow: hidden; }
  .auth-actions .auth-register .button-arrow { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .hero-copy { min-width: 0; }
  .hero-text { max-width: 100%; font-size: clamp(30px, 8.2vw, 48px); line-height: 1.08; overflow-wrap: anywhere; }
  .hero-benefits { gap: 10px; }
  .hero-actions { flex-wrap: wrap; gap: 12px; }
  .hero-visual { min-width: 0; min-height: clamp(260px, 78vw, 430px); }
  .hero-trader { max-width: 100%; object-fit: contain; object-position: center bottom; }
  .payout-card { max-width: min(210px, 58vw); }
  .hero-visual .payout-card { transform: translateX(-55px); }
  .landing-proof, .proof-panel { min-width: 0; }
  .proof-panel { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .proof-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .proof-stat { min-width: 0; }
  .proof-stat strong { font-size: clamp(19px, 6vw, 30px); }
  .proof-awards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .proof-award { min-width: 0; padding-inline: 4px; text-align: center; }
  .proof-award span { font-size: 10px; }
  .market-toolbar, .section-heading { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ticker-card { min-width: 0; padding: 12px; }
  .platform-inner { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .platform-art { min-width: 0; min-height: 230px; }
  .glass-panel { max-width: 100%; }
  .faq-wrap { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .faq-item { min-width: 0; }
  .footer-main { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .footer-main p, .footer-top { grid-column: auto; grid-row: auto; }
  .footer-bottom { flex-wrap: wrap; gap: 10px 16px; }
  .auth-drawer { width: min(100vw, 460px); max-height: 100dvh; overflow-y: auto; }
  .auth-form input, .auth-submit { min-height: 46px; }

  /* Cabinet navigation becomes a compact icon rail so the page keeps usable width. */
  .cabinet-content { --cabinet-sidebar-width: 62px !important; --cabinet-sidebar-collapsed: 62px !important; min-width: 0; }
  .cabinet-sidebar,
  .cabinet-content.is-collapsed .cabinet-sidebar { width: 62px !important; flex: 0 0 62px !important; padding: 12px 5px !important; }
  .cabinet-main,
  .cabinet-content.is-collapsed .cabinet-main { width: calc(100% - 62px) !important; min-width: 0; margin-left: 62px !important; }
  .cabinet-sidebar-top { justify-content: center; }
  .cabinet-sidebar-top .cabinet-brand,
  .cabinet-sidebar-label,
  .cabinet-nav-separator,
  .cabinet-sidebar-balance,
  .cabinet-sidebar-cta,
  .cabinet-account-meta,
  .cabinet-account-chevron,
  .cabinet-logout-button span { display: none !important; }
  .cabinet-sidebar-toggle { flex: 0 0 34px; width: 34px; height: 34px; }
  .cabinet-sidebar-nav-list { gap: 5px; }
  .cabinet-nav-link { min-height: 44px; justify-content: center; gap: 0; padding: 0 !important; }
  .cabinet-nav-link svg { width: 20px; height: 20px; flex: 0 0 20px; }
  .cabinet-sidebar-account { display: flex; justify-content: center; }
  .cabinet-account-trigger { width: auto; }
  .cabinet-logout-button { width: 100%; justify-content: center; padding: 10px 0; }
  .cabinet-quiet-header { height: auto; min-height: 56px; padding: 8px 10px; }
  .cabinet-main > * { min-width: 0; }
  .cabinet-home-overview, .cabinet-profile-layout, .cabinet-payouts-view, .cabinet-billing-view,
  .cabinet-main[data-cabinet-section="journal"] > * { max-width: 100%; }
  .cabinet-dashboard-grid, .cabinet-profile-layout, .cabinet-billing-layout,
  .cabinet-payout-card, .cabinet-journal-layout, .journal-lower-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .cabinet-profile-layout, .cabinet-home-overview, .cabinet-payouts-view, .cabinet-billing-view { width: calc(100% - 20px); margin-inline: 10px; }
  .cabinet-form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .cabinet-form-field, .cabinet-profile-panel, .cabinet-wallet-card, .cabinet-orders-section,
  .cabinet-identity-panel, .cabinet-payout-card, .cabinet-payout-gate { min-width: 0; }
  .cabinet-profile-form input, .cabinet-profile-form select, .cabinet-profile-form textarea,
  .cabinet-deposit-form input, .cabinet-deposit-form select { width: 100%; min-width: 0; }
  .cabinet-billing-tabs, .cabinet-orders-heading, .cabinet-billing-heading { flex-wrap: wrap; gap: 8px; }
  .cabinet-orders-table-wrap, .cabinet-payout-table-wrap, .cabinet-wallet-transactions,
  .cabinet-positions-table-wrap, .cabinet-trade-history-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cabinet-orders-table, .cabinet-payout-table, .cabinet-positions-table { min-width: 620px; }
  .journal-toolbar, .journal-calendar-controls, .journal-trade-tabs { flex-wrap: wrap; gap: 8px; }
  .journal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .journal-calendar-grid { grid-template-columns: repeat(7, minmax(28px, 1fr)); }

  /* Trading workspace: retain chart usability and allow all panels to scroll independently. */
  body.is-static-trading, body.is-static-dashboard, body.is-static-billing, body.is-static-payouts {
    width: 100%; height: auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto;
  }
  body.is-static-trading .cabinet-content, body.is-static-dashboard .cabinet-content,
  body.is-static-billing .cabinet-content, body.is-static-payouts .cabinet-content {
    height: auto; min-height: 100dvh; overflow: visible;
  }
  body.is-static-trading .cabinet-main, body.is-static-dashboard .cabinet-main,
  body.is-static-billing .cabinet-main, body.is-static-payouts .cabinet-main {
    height: auto; min-height: 100dvh; overflow: visible;
  }
  .cabinet-trading-view { height: min(78dvh, 760px) !important; min-height: 480px !important; }
  .cabinet-trading-chart { min-width: 0; min-height: 250px !important; }
  .cabinet-trading-chart .chart-head { flex-wrap: wrap; gap: 6px; padding-inline: 8px; }
  .cabinet-trading-chart .symbol-title { min-width: 0; }
  .cabinet-trading-chart .ohlc { overflow: hidden; max-width: 100%; font-size: 10px; }
  .cabinet-market-sidebar { max-width: min(342px, calc(100vw - 76px)); }
  .cabinet-positions-panel { min-width: 0; }
  .cabinet-positions-heading { flex-wrap: wrap; gap: 6px; }
  .cabinet-positions-table-wrap { overflow-x: auto; }

  /* Authenticated payment page and private admin panel */
  .payment-shell { width: calc(100% - 24px); padding-top: 14px; }
  .payment-brand { gap: 10px; }
  .payment-brand > span { text-align: right; }
  .payment-order { grid-template-columns: minmax(0, 1fr) auto; }
  .payment-footer { flex-wrap: wrap; }
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-sidebar { position: static; width: 100%; height: auto; }
  .admin-content { width: 100%; padding: 18px 14px 32px; }
  .admin-topbar { min-height: 50px; height: auto; padding: 10px 14px; }
  .admin-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-panel { min-width: 0; padding: 14px; }
  .admin-table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-create-user, .admin-toolbar, .admin-action-form, .admin-balance-form,
  .inline-form { flex-wrap: wrap; }
  .admin-create-user input, .admin-toolbar input, .admin-balance-form input,
  .inline-form input, .admin-action-form input, .admin-action-form select { min-width: 0; max-width: 100%; }
  .admin-login-card { width: min(100%, 420px); padding: 24px 18px; }

  /* Django admin and its per-user graph page */
  #container, #main, #content, #content-main, #changelist, #changelist-form,
  .change-form, .module, .inline-group { min-width: 0; max-width: 100%; }
  #content { padding: 14px 10px; }
  #content-main { overflow-x: auto; }
  #changelist-filter { position: static; width: auto; margin: 12px 0; }
  #changelist-filter details { display: inline-block; }
  .change-form .form-row { overflow-wrap: anywhere; }
  #graph-control { min-width: 0; padding-inline: 0 !important; }
  #gc-chart { height: 320px !important; }
  #graph-control table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #graph-control table thead, #graph-control table tbody { min-width: 700px; }
  #gc-balance-form { align-items: stretch !important; }
  #gc-balance-form label { flex: 1 1 100%; min-width: 0 !important; }
  #gc-balance-form input { width: 100% !important; }
}

@media (max-width: 480px) {
  .wrap { width: calc(100% - 22px); }
  .market-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-text { font-size: clamp(28px, 8.5vw, 38px); }
  .hero-visual { min-height: 270px; }
  .auth-actions { right: 46px; gap: 3px; }
  .auth-actions .auth-login, .auth-actions .auth-register { min-height: 34px; padding-inline: 6px; font-size: 10px; }
  .auth-actions .auth-register { max-width: 100px; }
  .proof-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .proof-stat strong { font-size: clamp(17px, 5.3vw, 23px); }
  .proof-stat span { font-size: 9px; }
  .proof-awards { grid-template-columns: minmax(0, 1fr); }
  .proof-award { display: flex; align-items: center; justify-content: center; gap: 8px; }
  .cabinet-trading-view { height: 72dvh !important; min-height: 440px !important; }
  .cabinet-trading-chart .ohlc { display: none; }
  .journal-metrics { grid-template-columns: minmax(0, 1fr) !important; }
  .admin-metrics { grid-template-columns: minmax(0, 1fr); }
  .payment-order { grid-template-columns: minmax(0, 1fr); }
  .payment-order > strong { grid-row: auto; }
}


/* Full-width cabinet layout on phones. Desktop rules are intentionally untouched. */
@media (max-width: 760px) {
  body.cabinet-body, body.cabinet-body.is-static-trading, body.cabinet-body.is-static-dashboard,
  body.cabinet-body.is-static-billing, body.cabinet-body.is-static-payouts {
    width: 100%; min-width: 0; min-height: 100dvh; height: auto;
    overflow-x: clip; overflow-y: auto; padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .cabinet-content, .cabinet-content.is-collapsed {
    display: block; width: 100%; min-width: 0; min-height: 100dvh; height: auto;
    overflow: visible; padding: 0; margin: 0;
    --cabinet-sidebar-width: 0px !important; --cabinet-sidebar-collapsed: 0px !important;
  }
  .cabinet-sidebar, .cabinet-content.is-collapsed .cabinet-sidebar {
    position: fixed !important; inset: auto 0 0 !important; z-index: 1000;
    display: block !important; width: 100% !important; height: auto !important; min-height: 0 !important;
    flex: none !important; margin: 0 !important; padding: 6px 5px calc(6px + env(safe-area-inset-bottom)) !important;
    border: 0 !important; border-top: 1px solid rgba(255,255,255,.12) !important; border-radius: 0 !important;
    background: rgba(10,14,18,.96) !important; box-shadow: 0 -8px 26px rgba(0,0,0,.35) !important;
    backdrop-filter: blur(18px) saturate(125%); -webkit-backdrop-filter: blur(18px) saturate(125%);
  }
  .cabinet-sidebar-top, .cabinet-sidebar-footer { display: none !important; }
  .cabinet-sidebar-nav, .cabinet-sidebar-nav.sidebar_main_menu_wrapper {
    display: grid !important; width: 100% !important; grid-template-columns: repeat(5,minmax(0,1fr));
    align-items: stretch; margin: 0 !important; padding: 0 !important;
  }
  .cabinet-sidebar-nav .sidebar_outerWrapper, .cabinet-sidebar-nav .sidebar_main,
  .cabinet-sidebar-nav-list { display: contents !important; }
  .cabinet-nav-item { display: block !important; min-width: 0; margin: 0 !important; padding: 0 !important; }
  .cabinet-sidebar .cabinet-nav-link {
    display: flex !important; width: 100% !important; min-width: 0; min-height: 52px !important;
    flex-direction: column; align-items: center; justify-content: center; gap: 3px !important;
    margin: 0 !important; padding: 4px 2px !important; border: 0 !important; border-radius: 9px !important;
    color: #aeb8be; text-align: center;
  }
  .cabinet-sidebar .cabinet-nav-link svg { display: block !important; width: 19px !important; height: 19px !important; flex: 0 0 19px !important; }
  .cabinet-sidebar .cabinet-sidebar-label {
    display: block !important; width: 100%; min-width: 0; overflow: hidden; flex: 0 1 auto;
    font-size: clamp(8px,2.5vw,10px) !important; line-height: 1.1 !important;
    text-align: center !important; text-overflow: ellipsis; white-space: nowrap;
  }
  .cabinet-sidebar .cabinet-nav-item.active > .cabinet-nav-link {
    color: #00ff51 !important; background: rgba(0,255,81,.07) !important;
    box-shadow: inset 0 0 0 1px rgba(0,255,81,.12) !important;
  }
  .cabinet-sidebar-toggle, .cabinet-nav-separator { display: none !important; }
  .cabinet-main, .cabinet-content.is-collapsed .cabinet-main {
    display: block !important; width: 100% !important; min-width: 0; min-height: 100dvh; height: auto !important;
    margin: 0 !important; padding: 0 0 18px !important; overflow: visible !important; transform: none !important;
  }
  .cabinet-quiet-header {
    position: sticky; top: 0; z-index: 20; display: flex; width: 100%; min-width: 0;
    height: auto !important; min-height: 0 !important; flex-wrap: wrap; gap: 7px;
    padding: 8px 10px !important; border-bottom: 1px solid rgba(255,255,255,.08);
    background: rgba(5,8,11,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  body.is-static-trading .trade-terminal-strip { display: grid !important; width: 100%; min-width: 0; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
  .trade-terminal-metric { min-width: 0; padding: 5px 6px; }
  .trade-terminal-metric span { overflow: hidden; font-size: 9px !important; text-overflow: ellipsis; white-space: nowrap; }
  .trade-terminal-metric strong { display: block; overflow: hidden; font-size: clamp(10px,3.2vw,13px) !important; text-overflow: ellipsis; white-space: nowrap; }
  .trade-terminal-metric.hide-sm { display: none !important; }
  .cabinet-trading-live-badge { margin-left: auto; font-size: 10px; }
  .cabinet-trading-deposit-button { min-height: 34px; padding: 0 10px; font-size: 11px; }

  .cabinet-home-overview, .cabinet-profile-layout, .cabinet-billing-view, .cabinet-payouts-view {
    box-sizing: border-box; width: auto !important; max-width: none !important;
    margin: 14px 10px 24px !important; padding-inline: 0 !important;
  }
  .cabinet-home-overview { padding-bottom: 20px; }
  .cabinet-dashboard-grid, .cabinet-profile-layout, .cabinet-billing-layout, .cabinet-payout-card,
  .cabinet-journal-layout, .journal-lower-grid, .cabinet-profile-content { grid-template-columns: minmax(0,1fr) !important; }
  .cabinet-profile-layout { gap: 12px !important; }
  .cabinet-profile-sidenav { position: static !important; width: auto !important; min-width: 0; }
  .cabinet-profile-identity { padding: 14px !important; }
  .cabinet-profile-subnav { display: flex !important; max-width: 100%; gap: 5px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: thin; }
  .cabinet-profile-subnav-item { flex: 0 0 auto; min-height: 40px; padding: 0 10px; font-size: 11px; white-space: nowrap; }
  .cabinet-profile-subnav-item svg { width: 16px; height: 16px; }
  .cabinet-profile-content, .cabinet-profile-panel, .cabinet-profile-panel-heading { min-width: 0; }
  .cabinet-profile-panel, .cabinet-profile-sidenav, .cabinet-identity-panel, .cabinet-profile-card,
  .cabinet-profile-form, .cabinet-profile-layout > * { max-width: 100%; }
  .cabinet-form-grid { grid-template-columns: minmax(0,1fr) !important; gap: 12px; }
  .cabinet-profile-form input, .cabinet-profile-form select, .cabinet-profile-form textarea,
  .cabinet-deposit-form input, .cabinet-deposit-form select, .cabinet-payout-form input {
    box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; font-size: 16px;
  }
  .cabinet-profile-form button, .cabinet-deposit-form button, .cabinet-payout-form button,
  .cabinet-profile-form input[type="file"] { max-width: 100%; min-height: 42px; }
  .cabinet-profile-panel-heading h1, .cabinet-billing-heading h1, .cabinet-payouts-heading h1 { font-size: 21px !important; }

  /* Keep the chart full width; place the instrument/order panel and positions below it. */
  .cabinet-trading-view, body.is-static-trading .cabinet-trading-view {
    display: grid !important; width: 100% !important; height: auto !important; min-height: 0 !important;
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-rows: minmax(390px,62dvh) auto var(--cabinet-positions-height,210px) !important;
    gap: 10px; overflow: visible !important; padding: 0 8px 12px; box-sizing: border-box;
  }
  .cabinet-trading-chart, .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-chart {
    grid-column: 1 !important; grid-row: 1 !important; width: 100% !important; height: 100% !important;
    min-width: 0 !important; min-height: 390px !important; margin: 0 !important; overflow: hidden;
    border-radius: 10px !important;
  }
  .apex-price-chart { width: 100% !important; min-width: 0 !important; min-height: 340px !important; }
  .cabinet-trading-chart .chart-head { min-width: 0; flex-wrap: wrap; gap: 5px; padding: 6px !important; }
  .cabinet-trading-chart .symbol-title { max-width: 45vw; overflow: hidden; font-size: 12px !important; text-overflow: ellipsis; }
  .cabinet-trading-chart .ohlc { display: none !important; }
  .cabinet-trading-chart #apex-chart-timeframes { max-width: 100%; gap: 2px; overflow-x: auto; }
  .cabinet-trading-chart #apex-chart-timeframes button { min-width: 32px; min-height: 30px; padding: 0 5px; font-size: 10px; }
  .cabinet-market-sidebar, .cabinet-main[data-cabinet-section="trading"] .cabinet-market-sidebar {
    position: relative !important; inset: auto !important; grid-column: 1 !important; grid-row: 2 !important;
    display: block !important; width: 100% !important; min-width: 0 !important; max-width: none !important;
    height: auto !important; max-height: none !important; margin: 0 !important; overflow: visible !important;
    border-radius: 10px !important;
  }
  .cabinet-market-content { display: grid; grid-template-columns: minmax(0,1fr); min-width: 0; }
  .cabinet-market-heading { display: flex; align-items: center; gap: 8px; }
  .cabinet-market-heading select { min-width: 0; max-width: 58%; min-height: 40px; font-size: 14px; }
  .cabinet-market-search { box-sizing: border-box; width: calc(100% - 24px); min-height: 42px; font-size: 16px; }
  .cabinet-market-watch { max-height: 220px; overflow: auto; -webkit-overflow-scrolling: touch; }
  .cabinet-market-row { min-height: 42px; }
  .cabinet-market-order { min-width: 0; padding: 12px !important; }
  .cabinet-market-order-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .cabinet-market-order-fields input, .cabinet-market-order select { min-width: 0; min-height: 42px; font-size: 16px; }
  .cabinet-order-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .cabinet-order-actions button { min-height: 46px; }
  .cabinet-positions-panel, .cabinet-main[data-cabinet-section="trading"] .cabinet-positions-panel {
    position: relative !important; grid-column: 1 !important; grid-row: 3 !important; width: 100% !important;
    min-width: 0 !important; min-height: 160px; height: auto !important; margin: 0 !important;
    overflow: hidden; border-radius: 10px !important;
  }
  .cabinet-positions-heading { min-height: 46px; flex-wrap: nowrap; gap: 4px; padding: 4px 8px; }
  .cabinet-positions-tabs { display: flex; min-width: 0; flex: 1; gap: 3px; overflow-x: auto; }
  .cabinet-positions-tabs button { min-height: 36px; padding: 0 8px; font-size: 10px; white-space: nowrap; }
  .cabinet-positions-collapse { flex: 0 0 36px; width: 36px; height: 36px; }
  .cabinet-positions-table-wrap, .cabinet-positions-panel .cabinet-positions-table-wrap { max-width: 100%; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .cabinet-positions-table { min-width: 650px !important; }
  .cabinet-positions-table th, .cabinet-positions-table td { padding: 9px 8px !important; font-size: 11px !important; }
  .cabinet-trading-view.is-positions-collapsed, .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view.is-positions-collapsed {
    grid-template-rows: minmax(390px,62dvh) auto 0px !important;
  }
  .cabinet-positions-panel.is-collapsed { min-height: 0 !important; }
  .cabinet-market-sidebar.is-collapsed { width: 100% !important; min-height: 42px !important; }
  .cabinet-market-sidebar.is-collapsed .cabinet-market-content { display: none !important; }
  .cabinet-market-sidebar.is-collapsed .cabinet-market-collapse { position: absolute !important; top: 4px; right: 4px; left: auto !important; }

  .cabinet-billing-heading, .cabinet-payouts-heading { min-height: 54px !important; margin: 0 -10px 12px !important; padding: 0 10px !important; }
  .cabinet-billing-tabs { display: flex; max-width: calc(100vw - 20px); gap: 14px; overflow-x: auto; white-space: nowrap; }
  .cabinet-billing-tabs a { min-height: 44px; font-size: 12px; }
  .cabinet-billing-layout { gap: 12px !important; }
  .cabinet-wallet-card, .cabinet-payout-card, .cabinet-payout-gate, .cabinet-payout-history,
  .cabinet-orders-section, .cabinet-billing-layout > *, .cabinet-payouts-view > * { min-width: 0; max-width: 100%; }
  .cabinet-wallet-head, .cabinet-wallet-body { padding-inline: 12px !important; }
  .cabinet-wallet-body { grid-template-columns: minmax(0,1fr) !important; }
  .cabinet-deposit-currency-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .cabinet-deposit-currency-options button { min-height: 42px; }
  .cabinet-orders-heading { align-items: flex-start !important; flex-direction: column; gap: 8px; }
  .cabinet-orders-heading label { width: 100%; }
  .cabinet-status-select, .cabinet-status-select-trigger { width: 100%; min-height: 42px; }
  .cabinet-orders-table-wrap, .cabinet-payout-table-wrap, .cabinet-wallet-transactions { width: 100%; max-width: 100%; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .cabinet-orders-table, .cabinet-payout-table { min-width: 680px !important; }
  .cabinet-orders-table th, .cabinet-orders-table td, .cabinet-payout-table th, .cabinet-payout-table td { padding: 10px 9px !important; font-size: 11px !important; }
  .cabinet-payout-card { display: grid !important; grid-template-columns: minmax(0,1fr) !important; gap: 12px !important; padding: 13px !important; }
  .cabinet-payout-balance { min-height: 96px !important; padding: 14px !important; }
  .cabinet-payout-balance strong { font-size: 26px !important; }
  .cabinet-payout-gate { grid-template-columns: 36px minmax(0,1fr) !important; gap: 10px !important; padding: 13px !important; }
  .cabinet-payout-gate-icon { width: 36px; height: 36px; }
  .cabinet-payout-gate > a { grid-column: 2; justify-self: start; white-space: normal; }

  .cabinet-orders-table-wrap, .cabinet-payout-table-wrap, .cabinet-positions-table-wrap,
  .cabinet-trade-history-table-wrap, .cabinet-wallet-transactions { scrollbar-width: thin; }
  .journal-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .journal-metrics { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 8px; }
  .journal-metric-card, .journal-win-card { min-width: 0; padding: 12px !important; }
  .journal-metric-card strong { font-size: 20px !important; }
  .journal-trade-tabs, .journal-calendar-controls { max-width: 100%; overflow-x: auto; }
  .journal-calendar-grid { grid-template-columns: repeat(7,minmax(0,1fr)) !important; gap: 3px !important; }
  .journal-calendar-day { min-width: 0 !important; min-height: 36px !important; padding: 3px !important; font-size: 10px !important; }

  .cabinet-wallet-modal { padding: 10px !important; }
  .cabinet-wallet-modal-dialog, .cabinet-instrument-picker { box-sizing: border-box; width: 100% !important; max-width: 100% !important; max-height: calc(100dvh - 24px) !important; overflow: auto; }
  .cabinet-instrument-categories { display: flex; max-width: 100%; overflow-x: auto; }
  .cabinet-instrument-categories button { flex: 0 0 auto; min-height: 40px; }
}

@media (max-width: 480px) {
  .cabinet-sidebar .cabinet-nav-link { min-height: 50px !important; }
  .cabinet-sidebar .cabinet-sidebar-label { font-size: 8px !important; }
  .cabinet-quiet-header { padding-inline: 7px !important; }
  .trade-terminal-metric { padding-inline: 4px; }
  .cabinet-trading-view, body.is-static-trading .cabinet-trading-view { grid-template-rows: minmax(370px,58dvh) auto var(--cabinet-positions-height,190px) !important; }
  .cabinet-trading-view.is-positions-collapsed, .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view.is-positions-collapsed { grid-template-rows: minmax(370px,58dvh) auto 0px !important; }
  .cabinet-trading-chart, .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-chart { min-height: 370px !important; }
  .apex-price-chart { min-height: 320px !important; }
  .cabinet-positions-tabs button { padding-inline: 6px; }
  .journal-metrics { grid-template-columns: minmax(0,1fr) !important; }
}


@media (max-width: 760px) {
  /* Keep account controls reachable while the desktop sidebar is replaced by bottom navigation. */
  .cabinet-sidebar-footer {
    position: fixed !important; inset: 7px 8px auto auto !important; z-index: 1002;
    display: block !important; width: auto !important; height: auto !important; margin: 0 !important;
    padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
  }
  .cabinet-sidebar-footer .cabinet-sidebar-balance, .cabinet-sidebar-footer .cabinet-sidebar-cta,
  .cabinet-sidebar-footer .cabinet-account-name, .cabinet-sidebar-footer .cabinet-logout-message { display: none !important; }
  .cabinet-sidebar-footer .cabinet-sidebar-account {
    display: flex !important; align-items: center; justify-content: flex-end; gap: 5px;
    width: auto !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important;
  }
  .cabinet-sidebar-footer .cabinet-account-avatar { display: none !important; }
  .cabinet-sidebar-footer .cabinet-sidebar-settings, .cabinet-sidebar-footer .cabinet-logout-button {
    display: inline-flex !important; width: 36px !important; min-width: 36px; height: 36px !important;
    align-items: center; justify-content: center; padding: 0 !important; border: 1px solid rgba(255,255,255,.11) !important;
    border-radius: 9px !important; background: #11171c !important; color: #dbe2e6 !important;
  }
  .cabinet-sidebar-footer .cabinet-sidebar-settings svg, .cabinet-sidebar-footer .cabinet-logout-button svg { width: 18px; height: 18px; }
  .cabinet-quiet-header { padding-top: 48px !important; }
  .cabinet-sidebar-nav-list.sidebar_menu.bottom .cabinet-sidebar-label { font-size: 0 !important; }
  .cabinet-sidebar-nav-list.sidebar_menu.bottom .cabinet-sidebar-label::after {
    content: "\41f\440\43e\444\438\43b\44c"; font-size: clamp(8px,2.5vw,10px); line-height: 1.1;
  }
}



/* Trade-only phone controls: the asset picker and quick orders stay above the chart. */
.cabinet-mobile-trade-controls { display: none; }
@media (max-width: 760px) {
  /* Keep the same fixed bottom section navigation in every cabinet view. */
  body.is-static-trading .cabinet-mobile-trade-controls {
    display: grid; width: 100%; grid-template-columns: minmax(70px,1fr) 62px 70px 58px 58px; gap: 5px;
    align-items: stretch; margin: 0; padding: 3px 0 0;
  }
  .cabinet-mobile-instrument-trigger, .cabinet-mobile-order-sell, .cabinet-mobile-order-buy {
    display: inline-flex; min-width: 0; min-height: 42px; align-items: center; justify-content: center;
    gap: 6px; padding: 0 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 7px;
    background: #11171c; color: #f0edec; font: 600 12px/1 "Inter",Arial,sans-serif; cursor: pointer;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  }
  .cabinet-mobile-instrument-trigger { justify-content: space-between; font-size: 13px; }
  .cabinet-mobile-instrument-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cabinet-mobile-instrument-trigger svg { width: 15px; height: 15px; flex: 0 0 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
  .cabinet-mobile-order-sell { border-color: rgba(239,74,74,.34); background: rgba(130,35,35,.28); }
  .cabinet-mobile-order-buy { border-color: rgba(16,212,142,.32); background: rgba(10,110,73,.3); }
  .cabinet-mobile-order-sell:disabled, .cabinet-mobile-order-buy:disabled { opacity: .45; }
  body.is-static-trading .cabinet-quiet-header { position: sticky; top: 0; z-index: 40; gap: 6px; padding: 7px 9px 9px !important; }
  body.is-static-trading .trade-terminal-strip { grid-template-columns: repeat(3,minmax(0,1fr)); }
  body.is-static-trading .trade-terminal-strip { width: calc(100% - 84px) !important; }
  body.is-static-trading .cabinet-trading-live-badge,
  body.is-static-trading .cabinet-trading-deposit-button { display: none !important; }
  body.is-static-trading .cabinet-trading-view,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view {
    height: auto !important; min-height: 0 !important;
    grid-template-rows: minmax(390px,calc(100dvh - 225px)) auto var(--cabinet-positions-height,190px) !important;
    gap: 8px; padding: 0 0 12px !important;
  }
  body.is-static-trading .cabinet-trading-chart,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-chart {
    grid-column: 1 !important; grid-row: 1 !important;
    width: 100% !important; height: 100% !important; min-height: 390px !important; margin: 0 !important;
    border-radius: 0 !important; border-right: 0 !important; border-left: 0 !important;
  }
  body.is-static-trading .apex-price-chart { min-height: 390px !important; }
  body.is-static-trading .cabinet-trading-chart .chart-head { position: relative; z-index: 2; }
  body.is-static-trading .cabinet-market-sidebar,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-market-sidebar {
    position: relative !important; inset: auto !important; grid-column: 1 !important;
    grid-row: 2 !important; margin: 0 8px !important; width: calc(100% - 16px) !important;
    min-height: 220px; max-width: none !important; box-shadow: none !important;
  }
  body.is-static-trading .cabinet-positions-panel,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-positions-panel {
    grid-row: 3 !important; margin: 0 8px !important; width: calc(100% - 16px) !important;
  }
  body.is-static-trading .cabinet-trading-view.is-positions-collapsed,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view.is-positions-collapsed {
    grid-template-rows: minmax(390px,calc(100dvh - 225px)) auto 0 !important;
  }
  body.is-static-trading .cabinet-market-sidebar.is-collapsed { width: calc(100% - 16px) !important; min-height: 42px; }
  body.is-static-trading .cabinet-market-sidebar.is-collapsed .cabinet-market-collapse { position: absolute !important; top: 3px; right: 3px; left: auto !important; }
  body.is-static-trading .cabinet-market-sidebar.is-collapsed .cabinet-market-content { display: none !important; }
  body.is-static-trading .cabinet-instrument-modal { z-index: 1100; }
  body.is-static-trading .cabinet-instrument-picker { width: calc(100vw - 20px) !important; }
}
@media (max-width: 480px) {
  body.is-static-trading .cabinet-mobile-trade-controls { grid-template-columns: minmax(60px,1fr) 54px 64px 50px 50px; gap: 4px; }
  body.is-static-trading .cabinet-mobile-instrument-trigger,
  body.is-static-trading .cabinet-mobile-order-sell,
  body.is-static-trading .cabinet-mobile-order-buy { min-height: 40px; padding-inline: 7px; font-size: 11px; }
  body.is-static-trading .cabinet-quiet-header { padding-inline: 7px !important; }
  body.is-static-trading .cabinet-trading-view,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view,
  body.is-static-trading .cabinet-trading-view.is-positions-collapsed,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view.is-positions-collapsed {
    grid-template-rows: minmax(360px,calc(100dvh - 215px)) auto var(--cabinet-positions-height,180px) !important;
  }
  body.is-static-trading .cabinet-trading-view.is-positions-collapsed,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view.is-positions-collapsed {
    grid-template-rows: minmax(360px,calc(100dvh - 215px)) auto 0 !important;
  }
  body.is-static-trading .cabinet-trading-chart,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-chart { min-height: 390px !important; }
}

@media (max-width: 760px) {
  body.cabinet-body:not(.is-static-trading) .cabinet-trading-view,
  body.cabinet-body:not(.is-static-trading) .cabinet-market-sidebar,
  .cabinet-main:not([data-cabinet-section="trading"]) .cabinet-trading-view,
  .cabinet-main:not([data-cabinet-section="trading"]) .cabinet-market-sidebar { display: none !important; }
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view { display: grid !important; }
  body.is-static-trading .cabinet-mobile-trade-controls { grid-template-columns: minmax(60px,1fr) 54px 64px 50px 50px !important; }
  .cabinet-mobile-lot-control {
    display: flex; min-width: 0; min-height: 42px; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; border: 1px solid rgba(255,255,255,.12); border-radius: 7px;
    background: #0c1014; color: #9ba6ad; font: 600 8px/1 "Inter",Arial,sans-serif; letter-spacing: .04em;
  }
  .cabinet-mobile-lot-control input {
    box-sizing: border-box; width: 100%; min-width: 0; height: 20px; padding: 0 2px;
    border: 0; outline: 0; background: transparent; color: #f0edec; font: 600 12px/1 "Inter",Arial,sans-serif;
    text-align: center; appearance: textfield; -moz-appearance: textfield;
  }
  .cabinet-mobile-lot-control input::-webkit-inner-spin-button,
  .cabinet-mobile-lot-control input::-webkit-outer-spin-button { margin: 0; appearance: none; }
  .cabinet-mobile-leverage-control select { box-sizing: border-box; width: 100%; min-width: 0; height: 20px; padding: 0 1px; border: 0; outline: 0; background: transparent; color: #f0edec; font: 600 10px/1 "Inter",Arial,sans-serif; text-align: center; }
}
@media (max-width: 480px) {
  body.is-static-trading .cabinet-mobile-trade-controls { grid-template-columns: minmax(60px,1fr) 50px 58px 48px 48px !important; }
  .cabinet-mobile-lot-control { min-height: 40px; }
}

/* Mobile account actions stay in the top-right account header area. */
.cabinet-mobile-account-actions { display: none; }
@media (max-width: 760px) {
  body:not(.is-static-trading) .trade-terminal-strip,
  body:not(.is-static-trading) .cabinet-mobile-trade-controls,
  body:not(.is-static-trading) .cabinet-trading-live-badge,
  body:not(.is-static-trading) .cabinet-trading-deposit-button { display: none !important; }
  .cabinet-sidebar-footer { display: none !important; }
  .cabinet-mobile-account-actions {
    position: fixed; top: 7px; right: 8px; z-index: 1200;
    display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  }
  .cabinet-mobile-account-actions .cabinet-sidebar-settings,
  .cabinet-mobile-account-actions .cabinet-logout-button {
    display: inline-flex !important; width: 36px !important; min-width: 36px; height: 36px !important;
    align-items: center; justify-content: center; padding: 0 !important;
    border: 1px solid rgba(255,255,255,.12) !important; border-radius: 8px !important;
    background: #11171c !important; color: #e2e8ec !important; box-shadow: none !important;
  }
  .cabinet-mobile-account-actions svg { width: 18px !important; height: 18px !important; }
  .cabinet-quiet-header { padding-top: 8px !important; }
  body:not(.is-static-trading) .cabinet-quiet-header { padding-right: 88px !important; }

  /* The separate market drawer is replaced by the header instrument selector and order buttons. */
  body.is-static-trading .cabinet-market-sidebar,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-market-sidebar { display: none !important; }
  body.is-static-trading .cabinet-trading-view,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view {
    grid-template-rows: minmax(430px,calc(100dvh - 205px)) var(--cabinet-positions-height,190px) !important;
  }
  body.is-static-trading .cabinet-positions-panel,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-positions-panel { grid-row: 2 !important; }
  body.is-static-trading .cabinet-trading-view.is-positions-collapsed,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view.is-positions-collapsed {
    grid-template-rows: minmax(430px,calc(100dvh - 205px)) 0 !important;
  }

  /* Neutral dark instrument picker; no inherited gold colors. */
  .cabinet-instrument-picker {
    border-color: rgba(255,255,255,.12) !important; border-radius: 10px !important;
    background: #0c1014 !important; color: #f0edec !important; box-shadow: 0 24px 72px rgba(0,0,0,.7) !important;
  }
  .cabinet-instrument-picker-head .cabinet-home-eyebrow,
  .cabinet-instrument-picker-head strong { color: #e8edf0 !important; }
  .cabinet-instrument-picker-head button { border-color: rgba(255,255,255,.1) !important; color: #d4dce1 !important; }
  .cabinet-instrument-search { border-color: rgba(255,255,255,.12) !important; background: #050506 !important; }
  .cabinet-instrument-search:focus-within { border-color: rgba(255,255,255,.3) !important; }
  .cabinet-instrument-search input, .cabinet-instrument-result { color: #e8edf0 !important; }
  .cabinet-instrument-search input::placeholder,
  .cabinet-instrument-result-info small,
  .cabinet-instrument-result-meta,
  .cabinet-instrument-note { color: #9ba6ad !important; }
  .cabinet-instrument-categories button { border-color: transparent !important; color: #b8c1c7 !important; }
  .cabinet-instrument-categories button:hover,
  .cabinet-instrument-categories button.is-active,
  .cabinet-instrument-result:hover,
  .cabinet-instrument-result:focus-visible { border-color: rgba(255,255,255,.12) !important; background: #1a1f24 !important; color: #fff !important; }
  .cabinet-instrument-results { scrollbar-color: rgba(255,255,255,.24) transparent !important; }
  .cabinet-instrument-more { border-color: rgba(255,255,255,.14) !important; background: #11171c !important; color: #e8edf0 !important; }
}

.cabinet-mobile-positions-open { display: none; }

/* Mobile-only trading terminal: fixed viewport, chart fills the available space. */
@media (max-width: 760px) {
  body.is-static-trading {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: manipulation;
  }
  body.is-static-trading .cabinet-content,
  body.is-static-trading .cabinet-content.is-collapsed {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  body.is-static-trading .cabinet-main,
  body.is-static-trading .cabinet-content.is-collapsed .cabinet-main {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  body.is-static-trading .cabinet-quiet-header {
    --mobile-trading-header-height: 106px;
    position: fixed !important;
    inset: 0 0 auto !important;
    z-index: 1100 !important;
    display: flex !important;
    width: 100vw !important;
    height: var(--mobile-trading-header-height) !important;
    min-height: var(--mobile-trading-header-height) !important;
    max-height: var(--mobile-trading-header-height) !important;
    box-sizing: border-box !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    padding: 6px 8px !important;
    overflow: visible !important;
  }
  body.is-static-trading .cabinet-mobile-account-actions {
    position: absolute !important;
    top: 5px !important;
    right: 8px !important;
    z-index: 5 !important;
  }
  body.is-static-trading .trade-terminal-strip {
    width: calc(100% - 82px) !important;
    height: 34px !important;
    min-height: 34px !important;
    flex: 0 0 34px !important;
  }
  body.is-static-trading .cabinet-mobile-trade-controls {
    flex: 0 0 42px !important;
    min-height: 42px !important;
    padding-top: 0 !important;
  }
  body.is-static-trading .cabinet-trading-view,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-view,
  body.is-static-trading .cabinet-trading-view.is-positions-collapsed {
    position: fixed !important;
    inset: var(--mobile-trading-header-height, 106px) 0 calc(64px + env(safe-area-inset-bottom)) !important;
    display: block !important;
    width: 100vw !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  body.is-static-trading .cabinet-trading-chart,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] .cabinet-trading-chart {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
  }
  body.is-static-trading .cabinet-trading-chart > #apex-price-chart {
    min-height: 0 !important;
    height: calc(100% - 50px) !important;
  }
  body.is-static-trading .cabinet-mobile-positions-open {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 8;
    display: inline-flex;
    width: auto;
    min-width: 112px;
    height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background: #11171c;
    color: #e8edf0;
    box-shadow: 0 3px 14px rgba(0,0,0,.38);
    touch-action: manipulation;
  }
  body.is-static-trading .cabinet-mobile-positions-open svg { width: 22px; height: 22px; }
  body.is-static-trading .cabinet-mobile-positions-open span { font: 600 13px/1 "Inter",Arial,sans-serif; }
  body.is-static-trading.is-mobile-positions-open .cabinet-mobile-positions-open { display: none !important; }
  body.is-static-trading #cabinet-positions-panel,
  body.is-static-trading .cabinet-main[data-cabinet-section="trading"] #cabinet-positions-panel {
    display: none !important;
  }
  body.is-static-trading.is-mobile-positions-open .cabinet-main[data-cabinet-section="trading"] #cabinet-positions-panel {
    position: fixed !important;
    inset: 106px 0 calc(64px + env(safe-area-inset-bottom)) !important;
    z-index: 1050 !important;
    display: flex !important;
    width: 100vw !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #111315 !important;
  }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-resize { display: none !important; }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-heading {
    flex: 0 0 54px !important;
    min-height: 54px !important;
    flex-wrap: nowrap !important;
    padding: 5px 10px !important;
    padding-top: max(5px, env(safe-area-inset-top)) !important;
  }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-tabs { overflow-x: auto; }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-collapse {
    display: inline-flex !important;
    position: static !important;
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    align-items: center;
    justify-content: center;
    margin-left: auto !important;
    transform: none !important;
  }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-collapse svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-table-wrap {
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    overscroll-behavior: contain;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body.is-static-trading.is-mobile-positions-open .cabinet-main[data-cabinet-section="trading"] #cabinet-positions-panel {
    display: flex !important;
    position: fixed !important;
    top: 106px !important;
    right: 0 !important;
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    left: 0 !important;
    transform: none !important;
  }
}

/* Compact interval picker shared by desktop and mobile charts. */
.cabinet-trading-chart .apex-timeframe-picker {
  position: relative !important;
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center;
  padding: 0 !important;
  overflow: visible !important;
}
.cabinet-trading-chart .apex-chart-settings { margin-left: auto !important; }
.cabinet-trading-chart #apex-timeframe-trigger {
  display: inline-flex !important;
  min-width: 58px !important;
  width: auto !important;
  height: 32px !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 9px !important;
  border: 1px solid #353a40 !important;
  border-radius: 5px !important;
  background: #11171c !important;
  box-shadow: none !important;
  color: #e8edf0 !important;
  font: 600 12px/1 "Inter",Arial,sans-serif !important;
  text-transform: none !important;
}
.cabinet-trading-chart #apex-timeframe-trigger:hover,
.cabinet-trading-chart #apex-timeframe-trigger[aria-expanded="true"] {
  border-color: #59616a !important;
  background: #1a1f24 !important;
}
.cabinet-trading-chart #apex-timeframe-trigger svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.cabinet-trading-chart #apex-timeframe-menu,
.cabinet-trading-chart #apex-timeframe-menu[hidden] {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  right: 0 !important;
  z-index: 30 !important;
  display: flex;
  width: 90px;
  max-height: min(60vh, 420px);
  flex-direction: column;
  gap: 1px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0c1014;
  box-shadow: 0 8px 24px rgba(0,0,0,.55);
  scrollbar-width: thin;
}
.cabinet-trading-chart #apex-timeframe-menu[hidden] { display: none !important; }
.cabinet-trading-chart #apex-timeframe-menu button {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 32px !important;
  min-height: 32px !important;
  align-items: center;
  justify-content: flex-start;
  padding: 0 9px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #c5cbd1 !important;
  font: 500 12px/1 "Inter",Arial,sans-serif !important;
  text-align: left;
  text-transform: none !important;
}
.cabinet-trading-chart #apex-timeframe-menu button:hover,
.cabinet-trading-chart #apex-timeframe-menu button.active {
  background: #20262c !important;
  color: #fff !important;
}
@media (max-width: 760px) {
  .cabinet-trading-chart #apex-timeframe-trigger { height: 30px !important; min-width: 56px !important; }
  .cabinet-trading-chart #apex-timeframe-menu { max-height: min(55dvh, 360px); }
}
@media (max-width: 760px) {
  body.is-static-trading .cabinet-trading-chart .chart-head {
    flex-wrap: nowrap !important;
    gap: 4px !important;
  }
  body.is-static-trading .cabinet-trading-chart .symbol-title {
    flex: 0 1 auto !important;
    min-width: 0 !important;
  }
  body.is-static-trading .cabinet-trading-chart .cabinet-mobile-account-actions {
    position: static !important;
    z-index: 8 !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center;
    gap: 8px !important;
    margin: 0 0 0 auto !important;
  }
  body.is-static-trading .cabinet-trading-chart .apex-chart-settings { margin-left: 8px !important; }
  body.is-static-trading .cabinet-trading-chart .cabinet-mobile-account-actions .cabinet-sidebar-settings,
  body.is-static-trading .cabinet-trading-chart .cabinet-mobile-account-actions .cabinet-logout-button {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    border-radius: 5px !important;
  }
  body.is-static-trading .cabinet-trading-chart .cabinet-mobile-account-actions svg { width: 16px !important; height: 16px !important; }
}
.cabinet-positions-minimize { display: none; }
@media (max-width: 760px) {
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-minimize {
    display: inline-flex !important;
    position: static !important;
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0;
    border: 1px solid #3a3e44;
    border-radius: 3px;
    background: #111315;
    color: #c9cdd2;
    font: 400 24px/1 "Inter",Arial,sans-serif;
  }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-collapse {
    margin-left: 6px !important;
  }
  body.is-static-trading.is-mobile-positions-open #cabinet-positions-panel .cabinet-positions-collapse::before {
    display: none !important;
    content: none !important;
  }
  body.is-static-trading.is-mobile-positions-open.is-mobile-positions-minimized .cabinet-main[data-cabinet-section="trading"] #cabinet-positions-panel {
    top: auto !important;
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    height: 54px !important;
    max-height: 54px !important;
    min-height: 54px !important;
    padding: 0 !important;
    border-top: 1px solid #30343a !important;
  }
  body.is-static-trading.is-mobile-positions-open.is-mobile-positions-minimized #cabinet-positions-panel .cabinet-positions-heading {
    height: 54px !important;
    min-height: 54px !important;
    flex-basis: 54px !important;
  }
  body.is-static-trading.is-mobile-positions-open.is-mobile-positions-minimized #cabinet-positions-panel .cabinet-positions-table-wrap {
    display: none !important;
  }
}

/* Keep the mobile viewport itself fixed horizontally; inner tables and chart keep their own gestures. */
@media (max-width: 760px) {
  html,
  body {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: clip !important;
    overscroll-behavior-x: none !important;
  }
  body.is-static-trading {
    position: fixed !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .cabinet-content,
  .cabinet-main,
  .cabinet-trading-view,
  .cabinet-trading-chart {
    max-width: 100% !important;
  }
  .cabinet-trading-chart .chart-head {
    box-sizing: border-box !important;
    max-width: 100% !important;
  }
}
