/* ==========================================================================
   Phone layout fixes for the workspace (screens up to 640px wide).
   Loaded after the app CSS via index.html. Desktop is not affected.
   ========================================================================== */
@media (max-width: 640px) {
  /* ---- Top header: logo row on top, buttons wrap into tidy rows ---- */
  .dg-mobile-header-bar {
    display: flex !important; flex-direction: column !important;
    align-items: stretch !important; gap: 8px !important;
    padding: 10px 12px !important; min-height: 0 !important;
  }
  .dg-mobile-header-brand-side { display: flex !important; justify-content: center; width: 100% !important; }
  .dg-mobile-header-actions {
    display: flex !important; flex-wrap: wrap !important;
    justify-content: center !important; align-items: center !important;
    gap: 6px !important; width: 100% !important;
  }
  .dg-mobile-header-actions > button,
  .dg-mobile-header-actions > a,
  .dg-mobile-header-actions > div > button {
    padding: 6px 10px !important; font-size: 10.5px !important;
    min-height: 32px; border-radius: 10px !important; white-space: nowrap;
  }
  /* credits + account block: full-width row of its own */
  .dg-mobile-header-actions > div.flex.items-center.gap-3,
  .dg-mobile-header-actions > div.relative.flex {
    flex: 1 1 100%; justify-content: center !important;
    margin: 2px 0 0 !important; padding: 0 !important; border: 0 !important;
  }
  .dg-mobile-header-actions > div.relative.flex { gap: 10px !important; }

  /* ---- Big headings inside cards: scale down so they fit ---- */
  p.text-3xl.font-black { font-size: 22px !important; letter-spacing: 0.06em !important; line-height: 1.15 !important; }

  /* ---- AI Actions grid: labels wrap instead of being cut off ---- */
  .dgp2-stack { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .dgp2-action { min-width: 0 !important; padding: 10px !important; }
  .dgp2-action .dgp2-gtext, .dgp2-action .dgp2-tl, .dgp2-action strong {
    white-space: normal !important; overflow-wrap: anywhere; min-width: 0 !important;
    font-size: 13px !important; line-height: 1.2 !important;
  }

  /* ---- General: nothing wider than the screen, tables scroll sideways ---- */
  img, video, canvas { max-width: 100%; }
  table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .app-main-shell { width: 100% !important; }

  /* ---- Comfortable tap targets ---- */
  .dg-mobile-input-panel button, .dgp2-action { min-height: 40px; }
}
