/* Phone and small-tablet layout for the whole FxTruebook app. */

@media (max-width: 900px) {
  html,
  body {
    overflow-x: hidden;
  }

  body.admin-layout {
    --topbar-height: 52px;
  }

  .admin-content {
    padding: 0.75rem 0 2rem;
  }

  .admin-content.container {
    width: calc(100% - 1rem);
  }

  .admin-topbar {
    gap: 0.4rem;
    padding-inline: 0.55rem;
    min-width: 0;
  }

  .admin-topbar-left,
  .admin-topbar-right,
  .admin-topbar-title {
    min-width: 0;
  }

  .admin-topbar-title strong {
    display: block;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.92rem;
  }

  .panel,
  .login-card,
  .dash-kpi,
  .strategy-card,
  .saved-result-card {
    padding: 0.9rem;
    border-radius: 12px;
  }

  .panel h2 {
    font-size: 1.12rem;
  }

  img,
  svg,
  video,
  canvas,
  iframe {
    max-width: 100%;
  }

  input,
  select,
  textarea,
  .grid-form > *,
  .live-bot-deploy-bar > *,
  .algo-grid > *,
  .algo-field-row > *,
  .paper-config-grid > *,
  label {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px;
    width: 100%;
  }

  .panel-head,
  .panel-head-row,
  .strategy-selected-head,
  .desk-history-section-head,
  .dash-section-head,
  .live-bot-header-actions,
  .panel-head-actions,
  .chart-terminal-actions,
  .table-toolbar,
  .trade-day-toolbar,
  .form-actions,
  .form-actions-bar {
    flex-wrap: wrap;
    min-width: 0;
  }

  .panel-head-actions,
  .live-bot-header-actions {
    flex-shrink: 1;
    width: 100%;
    justify-content: flex-start;
  }

  .section-nav {
    position: static;
    top: auto;
  }

  .section-nav-download {
    margin-left: 0;
  }

  .grid-form,
  .stats-grid,
  .params-grid,
  .params-grid.compact,
  .paper-config-grid,
  .paper-metrics,
  .paper-pnl-row,
  .chart-meta,
  .daily-grid,
  .dash-kpi-row,
  .dash-action-grid,
  .live-deploy-summary-grid,
  .live-bot-hud,
  .mt5-feed-grid,
  .result-hero,
  .result-hero-side,
  .profile-panel .profile-grid,
  .chart-terminal-toolbar,
  .chart-terminal-filters,
  .chart-replay-hud,
  .algo-field-row,
  .algo-name-row,
  .algo-grid-2,
  .algo-grid-3,
  .algo-grid-4,
  .algo-top-grid,
  .algo-trade-row,
  .leg-type-toggle,
  .strategy-detail-row,
  .strategy-icon-grid,
  .strategy-icon-meta,
  .saved-result-meta,
  .backtest-leg-grid,
  .live-bot-trade-detail-grid,
  .desk-broker-grid {
    grid-template-columns: 1fr 1fr;
  }

  .table-wrap,
  .mt5-feed-scroll,
  .trade-day .table-wrap,
  .desk-history-table,
  .live-bot-trades {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .trade-table,
  .day-trade-table,
  .trade-day-table,
  .desk-history-table table,
  .live-bot-trades table {
    min-width: 720px;
  }

  .mono,
  .paper-log,
  .paper-log li,
  .live-bot-log,
  .live-bot-signals-levels,
  pre,
  code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .js-plotly-plot,
  .plot-container,
  .svg-container {
    width: 100% !important;
    max-width: 100%;
  }

  .login-shell {
    padding: 1rem 0.75rem;
  }

  .login-card {
    width: min(100%, 420px);
    margin-inline: auto;
  }

  .asn-hero,
  .landing-hero,
  .asn-section {
    padding-inline: 1rem;
  }
}

@media (max-width: 560px) {
  .admin-content.container {
    width: calc(100% - 0.75rem);
  }

  .grid-form,
  .stats-grid,
  .params-grid,
  .params-grid.compact,
  .paper-config-grid,
  .paper-metrics,
  .paper-pnl-row,
  .chart-meta,
  .daily-grid,
  .dash-kpi-row,
  .dash-action-grid,
  .live-deploy-summary-grid,
  .live-bot-hud,
  .mt5-feed-grid,
  .result-hero,
  .result-hero-side,
  .profile-panel .profile-grid,
  .chart-terminal-filters,
  .chart-replay-hud,
  .algo-field-row,
  .algo-name-row,
  .algo-grid-2,
  .algo-grid-3,
  .algo-grid-4,
  .leg-type-toggle,
  .saved-result-meta,
  .backtest-leg-grid,
  .live-bot-trade-detail-grid,
  .desk-broker-grid {
    grid-template-columns: 1fr;
  }

  .dash-kpi-value,
  .live-deploy-summary-card strong {
    font-size: 1.25rem;
  }

  .btn,
  button.btn,
  a.btn,
  .sidebar-link,
  .sidebar-mobile-toggle {
    min-height: 40px;
  }

  .live-bot-board-count,
  .trade-day-pnl {
    margin-left: 0;
  }

  .trade-day summary,
  .live-bot-card header,
  .strategy-card-pro-top {
    align-items: flex-start;
  }

  .asn-chat-panel {
    width: calc(100vw - 1rem);
    height: min(68vh, 520px);
  }

  .strategy-detail-grid,
  .admin-content [class*="-grid"] {
    grid-template-columns: 1fr !important;
  }
}
