/* Mobile shell has one height owner. Header and menu participate in layout,
   avoiding independent fixed-bottom anchoring in the iOS compositor. */
@media (max-width: 640px) {
  html:has(.customer-shell), body:has(.customer-shell) { background: #07111e; }
  html[data-af-theme="light"]:has(.customer-shell),
  html[data-af-theme="light"] body:has(.customer-shell) { background: #f4f7fa; }
  body:has(.customer-shell) { min-height: 100dvh; }
  .customer-shell {
    height: var(--visual-height, var(--app-height, 100vh));
    height: 100dvh;
    min-height: 0;
  }
  .customer-shell > .topbar {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
  }
  .customer-shell > .body {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    padding: 0;
  }
  .customer-shell > .mobile-tabbar {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    margin: 0;
  }
  .customer-shell .customer-dashboard-panel {
    height: 100%;
    min-height: 100%;
  }
  .customer-shell .customer-home {
    flex: 1 0 auto;
    min-height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
  }
  .customer-shell .customer-home > .live-status-panel {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    min-height: 0;
  }
  .customer-shell .live-status-head { flex: 0 0 auto; }
  .customer-shell .status-tile-grid {
    flex: 1 0 auto;
    grid-template-rows: auto auto;
    min-height: 0;
  }
  .customer-shell .status-tile { justify-content: space-between; }
  .customer-shell .subscription-card { margin-top: auto; }
  .customer-shell .subscription-card.apex-usage-dashboard-card .subscription-card-head {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .customer-shell .subscription-card-head > div:first-child strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Compact rules remain for short viewports. Large phones regain comfortable
   type, touch targets and spacing, rather than leaving unused space below. */
@container af-client (min-height: 700px) {
  .customer-shell .customer-home { gap: 12px; }
  .customer-shell .live-status-head { margin-bottom: 12px; }
  .customer-shell .af-page-heading h2 { font-size: 23px; }
  .customer-shell .status-tile-grid { gap: 12px; }
  .customer-shell .status-tile { padding: 16px; gap: 12px; border-radius: 18px; }
  .customer-shell .status-tile-head { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; }
  .customer-shell .status-tile-icon { width: 36px; height: 36px; min-width: 36px; }
  .customer-shell .status-tile-icon svg { width: 20px; height: 20px; }
  .customer-shell .status-tile-info strong { font-size: 18px; }
  .customer-shell .status-tile-info small { font-size: 12px; line-height: 1.4; }
  .customer-shell .status-tile-action { min-height: 46px; padding: 10px 12px; font-size: 14px; }
  .customer-shell .status-tile-secondary { min-height: 32px; font-size: 12px; }
  .customer-shell .status-tile.checkin .checkin-window { padding-top: 8px; }
  .customer-shell .checkin-window .window-label { font-size: 11px; }
  .customer-shell .checkin-window .window-hours { font-size: 16px; }
  .customer-shell .next-block-head { margin-bottom: 8px; }
  .customer-shell .next-block-head h3 { font-size: 15px; }
  .customer-shell .next-block-empty { min-height: clamp(80px, 13cqh, 104px); gap: 6px; justify-content: center; }
  .customer-shell .next-block-empty strong { font-size: 13px; }
  .customer-shell .next-block-empty small { font-size: 11px; }
  .customer-shell .next-block-details { padding: 12px; gap: 8px; }
  .customer-shell .next-block-details div { padding: 7px 9px; }
  .customer-shell .next-block-details strong { font-size: 13px; }
}
