/* MostlyPrivacy — phone + tablet layout. Loaded after app.css.
   The shell itself (drawer nav, menu button) is the shared DashboardShell in
   @mostly-tiny/ui; this file only adapts MostlyPrivacy's own screens to it.
   Guarded by e2e/mobile-no-overflow.spec.js: nothing may widen the page at 390px. */

/* ── Top bar overflow menu (App.jsx TopbarMore) — hidden on desktop ─────── */
.app-topbar__tools { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-topbar__more { display: none; position: relative; flex: none; }
.app-more {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: min(260px, calc(100vw - 20px));
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.app-more__row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 10px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  font-family: var(--font-sans); font-size: 14px; color: var(--fg);
}
.app-more__row:hover { background: var(--bg-row-hover); }
.app-more__row svg { color: var(--fg-muted); }
.app-more__lang { padding: 8px 4px 4px; margin-top: 4px; border-top: 1px solid var(--hairline); }
.app-more__lang .lang-switch { display: flex; }
.app-more__lang .lang-switch button { flex: 1; }

/* Language pills never break a two-letter code across lines. */
.lang-switch button { white-space: nowrap; }

/* ── Dashboard content that can't shrink scrolls inside its own card ─────── */
.app-view :has(> .forge-table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.app-view .forge-card { min-width: 0; }
.app-grid2 > * { min-width: 0; }

/* Tablet with the rail still showing: the search pill goes first, and the
   multi-column rows/panes switch to their stacked layouts. */
@media (max-width: 1080px) {
  .app-search { display: none; }
  .app-grid2 { grid-template-columns: minmax(0, 1fr); }
  .app-stats[style*="repeat(5"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

  /* Sites: each row becomes a small card — name, then a 3-up status strip, then actions. */
  .site-card { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding: 16px; }
  .site-card__name { grid-column: 1 / -1; min-width: 0; }
  .site-card__name > div { min-width: 0; }
  .site-card__dom { overflow-wrap: anywhere; }
  .site-card__actions { grid-column: 1 / -1; flex-wrap: wrap; }
  .site-card[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) auto auto !important; }
  .site-card[style*="grid-template-columns"] .site-card__name { grid-column: auto; }

  /* Banner builder: editor then preview, one page scroll instead of two panes. */
  .forge-dash__bleed:has(> .bb) { overflow-y: auto; display: block; }
  .bb { grid-template-columns: minmax(0, 1fr); height: auto; }
  .bb__controls { border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; padding: 18px 16px 24px; }
  .bb__preview { overflow: visible; padding: 18px 16px 40px; }
  .bb-seg { flex-wrap: wrap; }
  .bb-seg button { flex: 1 1 30%; }
  .bb-preview-toolbar { flex-wrap: wrap; gap: 10px; }
  .bb-preview-toolbar > div { margin-left: 0 !important; flex-wrap: wrap; }
  .bb-site { min-height: 420px; }
  .bb-site__addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bb-site__page { padding: 22px 18px; min-height: 380px; }
  .bb-site__hero-h { font-size: 24px; }
  .bb-site__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cw--corner { left: 12px; right: 12px; bottom: 12px; width: auto; }

}

@media (max-width: 760px) {
  /* Top bar: menu · current view · overflow. */
  .app-topbar__tools { display: none; }
  .app-topbar__more { display: block; }
  .app-crumbs { min-width: 0; font-size: 15px; }
  .app-crumbs > span:not(.app-crumbs__now) { display: none; }
  .app-crumbs__now { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Drawer: the workspace card reads at full width. */
  .app-side__org-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Headings + stat tiles. */
  .app-h1 { font-size: 23px; }
  .app-view__head { align-items: flex-start; margin-bottom: 18px; }
  .app-stats { gap: 10px; }
  .app-stats[style*="repeat(5"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .app-stats[style*="repeat(5"] > :first-child { grid-column: 1 / -1; }
  .relief { flex-wrap: wrap; gap: 12px 14px; padding: 16px; }
  .relief__badge { width: 42px; height: 42px; }
  .relief > div:nth-child(2) { flex: 1 1 180px; min-width: 0; }
  .relief__meta { margin-left: 0; text-align: left; flex-basis: 100%; }
  .app-card-head { flex-wrap: wrap; }
  .app-card-title { white-space: normal; }

  /* ── Landing ── */
  .mp-nav__inner { gap: 12px; }
  .mp-nav__cta { gap: 4px; min-width: 0; }
  .mp-brand { flex: none; }
  .loc-card--back1 { transform: translate(8px, -10px) scale(0.965) rotate(1.2deg); }
  .loc-card--back2 { transform: translate(14px, -18px) scale(0.93) rotate(2.2deg); }
  .loc-card--front { padding: 24px 22px 26px; }
  .cw--bar { left: 10px; right: 10px; bottom: 10px; }
  .cw--bar .cw__body { flex-basis: 100%; min-width: 0; padding: 16px 16px 4px; }
  .cw--bar .cw__actions { flex-shrink: 1; min-width: 0; margin-left: 0; padding: 4px 16px 14px; }
}

@media (max-width: 420px) {
  .mp-nav__inner { gap: 8px; }
  .mp-nav .mp-brand__name { font-size: 17px !important; }
  .mp-nav__cta .forge-btn { padding-left: 9px; padding-right: 9px; font-size: 12.5px; }
  .mp-nav__cta .forge-btn svg { display: none; }
  .site-card__actions .forge-btn { flex: 1 1 auto; }
}
