/* PoloStake 10.53 — exclusivamente mobile. app.css/desktop preservados. */
@media (max-width: 899px) {
  :root { --ps-ticker-h: calc(40px + env(safe-area-inset-top, 0px)); --ps-header-h: 112px; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  html body:not(:has(.mobile-bottom-nav)) { --ps-ticker-h: 0px; --ps-header-h: 64px; }
  html body { font-size: 14px; line-height: 1.45; }
  html body .market-ticker { height: var(--ps-ticker-h) !important; padding-top: env(safe-area-inset-top, 0px) !important; box-sizing: border-box !important; }
  html body .shell.v4-shell { min-width: 0 !important; max-width: 100% !important; box-sizing: border-box !important; }
  html body .shell.v4-shell.with-bottom-nav {
    padding-top: calc(var(--ps-ticker-h) + var(--ps-header-h) + 16px) !important;
    padding-bottom: calc(94px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Logo/perfil em cima; saldo e depósito em uma segunda linha confortável. */
  html[data-device] body:has(.mobile-bottom-nav) main.shell.v4-shell header.brandbar.v4-brandbar {
    display: grid !important; grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 44px 44px !important; gap: 8px !important;
    height: var(--ps-header-h) !important; min-height: var(--ps-header-h) !important;
    max-height: var(--ps-header-h) !important; top: var(--ps-ticker-h) !important;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)) !important;
    width: 100% !important; box-sizing: border-box !important; overflow: visible !important;
  }
  html[data-device] body:has(.mobile-bottom-nav) main.shell.v4-shell header.brandbar.v4-brandbar .v4-brand {
    grid-row: 1; height: 44px !important; min-height: 44px !important; max-height: 44px !important; width: auto !important; min-width: 0 !important;
    max-width: calc(100% - 104px) !important; padding: 0 !important; gap: 8px !important;
    flex: initial !important;
  }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .brand-mark { width: 40px !important; min-width: 40px !important; max-width: 40px !important; height: 40px !important; min-height: 40px !important; max-height: 40px !important; flex: 0 0 40px !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .brand-name { font-size: 21px !important; white-space: nowrap !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .brand-sub { display: block !important; font-size: 8px !important; letter-spacing: .09em !important; }
  html[data-device] body:has(.mobile-bottom-nav) main.shell.v4-shell header.brandbar.v4-brandbar .v4-head-actions {
    grid-row: 2; position: static !important; display: flex !important; gap: 10px !important; width: 100% !important;
    min-width: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
  }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .header-account-meta { display: none !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .account-picker { flex: 1 1 0 !important; min-width: 0 !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .header-balance {
    width: 100% !important; min-width: 0 !important; max-width: none !important;
    min-height: 44px !important; padding: 0 !important; text-align: left !important;
  }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .header-balance small.balance-label {
    display: block !important; font-size: 11px !important; color: #a8bfce !important;
    line-height: 16px !important; letter-spacing: .04em !important;
  }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .balance-label-desktop { display: none !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .header-balance .balance-row { justify-content: flex-start !important; gap: 6px !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .header-balance strong.privacy-value { font-size: 17px !important; text-align: left !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .privacy-eye { min-width: 44px !important; width: 44px !important; min-height: 44px !important; height: 44px !important; margin-top: -16px !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .header-deposit { min-height: 44px !important; padding: 0 14px !important; font-size: 13px !important; flex: 0 0 auto !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .profile-button,
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .bell-button { position: absolute !important; top: 8px !important; width: 44px !important; height: 44px !important; min-width: 44px !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .profile-button { right: max(12px, env(safe-area-inset-right, 0px)) !important; }
  html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .bell-button { right: calc(max(12px, env(safe-area-inset-right, 0px)) + 52px) !important; }
  html body .account-picker-menu { right: auto !important; left: 0 !important; width: min(280px, calc(100vw - 28px)) !important; box-sizing: border-box !important; }
  html body .account-picker-menu button { min-height: 44px !important; }
  /* Corrige a reserva fantasma da rail, inclusive os overrides globais tardios. */
  html body:has(.settings-with-rail) .settings-with-rail { display: block !important; width: 100% !important; min-width: 0 !important; }
  html body:has(.settings-with-rail) .settings-main-col {
    margin: 0 !important; padding: 12px !important; width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box !important;
  }
  html body .live-config-rail { display: none !important; }
  html body .live-main-col { margin-left: 0 !important; width: 100% !important; min-width: 0 !important; padding: 0 12px !important; box-sizing: border-box !important; }
  html body .v4-page-head h1, html body .signals-page-titles h1 { font-size: 24px !important; line-height: 1.25 !important; }
  html body .v4-page-head p, html body .signals-page-titles p,
  html body .section-help, html body .mini-meta, html body .info-strip,
  html body .risk-note, html body .live-card-hint { font-size: 13px !important; line-height: 1.5 !important; overflow-wrap: anywhere; }
  html body .v4-card { padding: 16px !important; min-width: 0 !important; box-sizing: border-box !important; }
  html body .v4-card h2, html body .live-panel-head h2 { font-size: 15px !important; line-height: 1.4 !important; }
  html body .settings-stack { gap: 14px !important; }
  html body .mode-grid, html body .setup-grid-4 { grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; }
  html body .select-card, html body .check-card { min-height: 64px !important; padding: 12px !important; gap: 12px !important; }
  html body .select-card b, html body .check-card b, html body .broker-current b { font-size: 15px !important; }
  html body .select-card small, html body .check-card small, html body .broker-current small { font-size: 12px !important; line-height: 1.45 !important; }
  html body .setup-icon-new { width: 56px !important; min-width: 56px !important; height: 56px !important; }
  html body .setup-copy em { font-size: 10px !important; }
  html body .broker-current { gap: 12px !important; padding: 12px !important; }
  html body .broker-account-actions { width: 100% !important; margin: 0 !important; gap: 8px !important; }
  html body .broker-account-actions button { flex: 1 1 130px !important; min-height: 44px !important; font-size: 13px !important; }
  html body .settings-stack label, html body .stats-filters label { font-size: 13px !important; }
  html[data-device] body main.shell.v4-shell input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  html[data-device] body main.shell.v4-shell select, html[data-device] body main.shell.v4-shell textarea { font-size: 16px !important; min-height: 44px !important; max-width: 100%; min-width: 0; box-sizing: border-box; }
  html body .gold-action, html body button.primary, html body a.primary,
  html body .signals-clear-btn, html body .segment-control a { min-height: 44px !important; font-size: 13px !important; }
  html body .time-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 10px !important; }
  html body .days-row { display: flex !important; flex-wrap: wrap !important; gap: 8px !important; }
  /* Cards do painel sem compressão de conteúdo, mantendo a mesma identidade. */
  html body .live-hero-grid, html body .live-lower.live-lower-v34 { grid-template-columns: minmax(0, 1fr) !important; }
  html body .live-kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px !important; }
  html body .live-main-col .live-kpis > :last-child,
  html body .live-main-col .live-kpis > :nth-child(3) { grid-column: 1 / -1 !important; }
  html body .risk-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px !important; }
  html body .risk-grid b { overflow-wrap: anywhere; font-size: 16px !important; }
  html body .risk-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 10px !important; }
  html body .risk-actions button { min-height: 48px !important; width: 100% !important; white-space: normal !important; font-size: 13px !important; }
  html body .kpi-head span, html body .kpi-sub, html body .session-status { font-size: 12px !important; line-height: 1.5 !important; }
  html body .live-kpi, html body .live-risk { padding: 14px !important; min-height: 150px !important; min-width: 0 !important; }
  html body .kpi-val { font-size: 24px !important; line-height: 1.2 !important; }
  html body .live-kpi small, html body .live-risk small, html body .live-welcome small { font-size: 12px !important; line-height: 1.4 !important; }
  html body .live-welcome h1 { font-size: 24px !important; }
  html body .live-opbody { flex-wrap: wrap !important; gap: 14px !important; }
  html body .live-opbody > div { width: 100% !important; min-width: 0 !important; }
  html body .live-opnums { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px !important; }
  html body .live-opnums > div:last-child { grid-column: 1 / -1 !important; }
  html body .live-opnums small { font-size: 12px !important; }
  html body .live-opnums b { font-size: 18px !important; overflow-wrap: anywhere; }
  html body button.live-stop { width: 100% !important; min-height: 52px !important; }
  html body button.live-stop b { font-size: 15px !important; }
  html body button.live-stop small { font-size: 12px !important; }
  /* Um livro por linha; rolagem pertence à página, não a pequenos painéis. */
  html body .signals-page { padding: 0 12px 18px !important; min-width: 0 !important; }
  html body .signals-filter-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; padding: 12px !important; gap: 12px !important; }
  html body .sig-f-search, html body .signals-clear-btn { grid-column: 1 / -1 !important; }
  html body .signals-filter-bar .sig-f > span { font-size: 11px !important; }
  html body .signals-setup-grid, html body .signals-page .signals-setup-grid,
  html body .signals-books-pair, html body .history-books-pair,
  html body .dash-dual-books { grid-template-columns: minmax(0, 1fr) !important; min-height: 0 !important; gap: 12px !important; }
  html body .signals-setup-head { padding: 14px !important; }
  html body .signals-setup-head h2, html body .signals-book-head b,
  html body .dash-book-head b, html body .history-book-head b { font-size: 14px !important; }
  html body .signals-setup-badge, html body .signals-book-head em { font-size: 11px !important; }
  html body .signals-book-scroll, html body .history-book-scroll,
  html body .dash-book-scroll, html body .activity-feed {
    max-height: none !important; height: auto !important; min-height: 0 !important; overflow: visible !important;
  }
  html body .signals-book { border-right: 0 !important; border-bottom: 1px solid #234052 !important; }
  html body .signals-book-cols { display: none !important; }
  html body .signals-row.one-line {
    display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important; padding: 12px !important; min-height: 82px !important; max-height: none !important;
    height: auto !important; font-size: 13px !important; white-space: normal !important;
  }
  html body .signals-row.one-line time { font-size: 12px !important; }
  html body .signals-row.one-line time i { font-size: 11px !important; }
  html body .signals-row.one-line .side { justify-self: end; font-size: 12px !important; }
  html body .signals-row.one-line .lvl { font-size: 13px !important; white-space: normal !important; }
  html body .signals-row.one-line .lvl.tp::before { content: 'TP '; color: #a8bfce; font-size: 11px; }
  html body .signals-row.one-line .lvl.sl::before { content: 'SL '; color: #a8bfce; font-size: 11px; }
  html body .signals-row.one-line .ticket { grid-column: 1 / -1 !important; font-size: 12px !important; white-space: normal !important; overflow-wrap: anywhere; }
  html body .signals-row.one-line .skip-reason { font-size: 12px !important; line-height: 1.5 !important; }
  html body .signals-kpi small, html body .signals-kpi em, html body .signals-kpi-pills i { font-size: 12px !important; }
  html body .history-source-banner small { font-size: 12px !important; line-height: 1.5 !important; }
  html body .history-source-banner b { font-size: 14px !important; }
  html body .history-row { grid-template-columns: auto minmax(0, 1fr) auto !important; grid-template-areas: 'icon main chevron' 'icon meta result' !important; padding: 14px 12px !important; gap: 8px !important; }
  html body .history-row-icon { grid-area: icon !important; }
  html body .history-row-main { grid-area: main !important; }
  html body .history-row-chevron { grid-area: chevron !important; }
  html body .history-row-stake { grid-area: meta !important; }
  html body .history-row-result { grid-area: result !important; }
  html body .history-row-title { font-size: 14px !important; white-space: normal !important; }
  html body .history-row-sub { font-size: 12px !important; }
  html body .history-row-result, html body .history-row-stake { font-size: 13px !important; min-width: 0 !important; }
  html body .dash-hist-row { grid-template-columns: minmax(0, 1fr) auto !important; font-size: 13px !important; padding: 12px !important; gap: 8px !important; }
  html body .dash-hist-row b, html body .dash-when, html body .dash-hist-row .tag,
  html body .sig-flag { font-size: 12px !important; }
  html body .stat-card-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px !important; }
  html body .stat-card-grid small, html body .strategy-mini small, html body .summary-list { font-size: 13px !important; }
  html body .stats-dual { grid-template-columns: minmax(0, 1fr) !important; }
  html body .status-row { gap: 12px !important; flex-wrap: wrap !important; font-size: 13px !important; }
  html body .status-row b { overflow-wrap: anywhere; }
  html body .mobile-bottom-nav { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; padding-top: 6px !important; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important; min-height: calc(74px + env(safe-area-inset-bottom, 0px)) !important; }
  html body .mobile-bottom-nav a { min-height: 60px !important; padding: 6px 2px !important; gap: 5px !important; }
  html body .mobile-bottom-nav a small { font-size: 10px !important; line-height: 12px !important; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; text-align: center; overflow-wrap: anywhere; }
  html body .mobile-bottom-nav a span { font-size: 21px !important; }
  html body .mobile-bottom-nav a:nth-child(5) small,
  html body .mobile-bottom-nav a:nth-child(6) small { font-size: 0 !important; line-height: 12px !important; }
  html body .mobile-bottom-nav a:nth-child(5) small::after { content: 'Config.'; font-size: 10px; }
  html body .mobile-bottom-nav a:nth-child(6) small::after { content: 'VIP'; font-size: 10px; }
  html body .signal-road .road { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; min-width: 0 !important; max-width: 100% !important; padding: 0 !important; }
  html body .signal-road .road::before, html body .signal-road .road::after { display: none !important; }
  html body .signal-road .road .stage { display: grid !important; grid-template-columns: 36px minmax(0, 1fr) !important; align-items: center !important; gap: 12px !important; min-width: 0 !important; width: 100% !important; text-align: left !important; }
  html body .signal-road .road .stage i { margin: 0 !important; }
  html body .signal-road .road .stage b { font-size: 12px !important; line-height: 1.4 !important; white-space: normal !important; }
  @media (max-width: 374px) {
    html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .brand-name { font-size: 18px !important; }
    html[data-device] body main.shell.v4-shell header.brandbar.v4-brandbar .brand-sub { font-size: 7px !important; }
    html body .live-kpis { grid-template-columns: minmax(0, 1fr) !important; }
    html body .time-grid { grid-template-columns: minmax(0, 1fr) !important; }
  }
}
