/* Cloud Engine dashboard UI v4.7 — silent mobile refresh and narrow-phone polish.
 * Presentation only: compact trade metadata, protection wording and centred trade
 * details. Five-second refresh stability is handled by preserving the live page node
 * rather than painting a snapshot or hiding/restoring the dashboard.
 */

@media (max-width: 760px) {
  /* Keep symbol and metadata on one calm baseline. The JS shortens "Alert 1" to
     "#1" on phones so 320px-wide layouts retain the complete metadata. */
  .dashboard-v3[data-dashboard-ui-v4] .dashboard-v4-trade {
    display: flex !important;
    min-width: 0;
    align-items: baseline;
    gap: 10px !important;
  }
  .dashboard-v3[data-dashboard-ui-v4] .dashboard-v4-trade strong {
    flex: 0 0 auto;
    margin: 0;
  }
  .dashboard-v3[data-dashboard-ui-v4] .dashboard-v4-trade small {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dashboard-v3[data-dashboard-ui-v4] .dashboard-v4-trade small i {
    padding: 0 5px;
  }

  /* On mobile the skip reason is already permanently visible at the foot of the
     card, so the additional Why? affordance is redundant. */
  .dashboard-v3[data-dashboard-ui-v4] .dashboard-v4-why {
    display: none !important;
  }
  .dashboard-v3[data-dashboard-ui-v4] .day-alert-row[data-trade-filter="skipped"] .dashboard-v4-skip-reason {
    display: block !important;
  }

  /* Mobile needs only the protection outcome itself; remove the repeated field
     label and give the outcome enough breathing room for the clearer wording. */
  .dashboard-v3[data-dashboard-ui-v4] .protection-cell.dashboard-v4-state-cell {
    display: flex;
    min-height: 35px;
    min-width: 0;
    align-items: flex-end;
    align-self: end;
    justify-content: flex-start;
    justify-items: start;
  }
  .dashboard-v3[data-dashboard-ui-v4] .protection-cell.dashboard-v4-state-cell > small {
    display: none !important;
  }
  .dashboard-v3[data-dashboard-ui-v4] .dashboard-v4-protection {
    min-height: 27px;
    max-width: 100%;
    padding: 5px 9px;
    font-size: 8.25px;
    line-height: 1;
    white-space: nowrap;
  }

  /* The trade-details View dialog is a centred modal on phones, not a bottom
     sheet. Strategy keeps its existing mobile treatment. */
  .dashboard-v4-dialog.trade-detail-v4[open] {
    position: fixed;
    inset: 50% auto auto 50%;
    width: min(460px, calc(100vw - 28px));
    max-width: 460px;
    max-height: calc(100dvh - 32px);
    margin: 0 !important;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(53, 102, 137, .62) !important;
    border-radius: 16px !important;
  }
  .dashboard-v4-dialog.trade-detail-v4 .dashboard-v4-dialog-shell {
    max-height: calc(100dvh - 32px);
  }
  .dashboard-v4-dialog.trade-detail-v4 header {
    padding-top: 16px;
  }
  .dashboard-v4-dialog.trade-detail-v4 footer {
    padding-bottom: max(13px, env(safe-area-inset-bottom));
  }
}
