/* vv746 phone layout fix (2026-09-28, additive). Phone widths only.
   Goals at 390: no chrome over content, no text off-screen, one top banner at a time,
   cookie bar never over the bottom nav. Rollback = remove the <link> from the shells. */
@media (max-width: 640px) {
  /* ---------- One banner slot at the top ---------- */
  /* App-install pill becomes a full-width strip in a reserved 48px slot. */
  body > .vv-app-banner {
    top: 0 !important; left: 0 !important; right: 56px !important; bottom: auto !important;
    transform: none !important; width: auto !important; max-width: none !important;
    height: 48px !important; min-height: 48px !important; margin: 0 !important; border-radius: 0 !important;
    padding: 0 8px 0 12px !important; box-sizing: border-box !important;
    display: flex; align-items: center !important; justify-content: space-between !important; gap: 10px !important;
    z-index: 10030 !important; background: #0E231C !important; border: 0 !important;
    border-bottom: 1px solid rgba(212,175,55,.45) !important; box-shadow: none !important;
  }
  body > .vv-app-banner > div:first-child { min-width: 0; overflow: hidden; }
  body > .vv-app-banner strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  body > .vv-app-banner p { display: none !important; }
  body > .vv-app-banner .vv-app-banner-actions { flex-shrink: 0; }
  body > .vv-app-banner .vv-app-banner-actions button { min-height: 36px !important; height: 36px !important; padding: 0 12px !important; white-space: nowrap; }
  /* Cookie bar present: it owns the top slot, the app pill waits. */
  body:has(> [class*="z-[100000]"]) > .vv-app-banner { display: none !important; }
  /* Page content starts below the slot whenever something occupies it. */
  body.vv-my-dashboard-surface #root,
  body:has(> .vv-app-banner:not([style*="none"])):not(.vv-vs-p0):not(.vv-agent-desk-app) #root { padding-top: 48px !important; box-sizing: border-box; }
  /* Floating avatar sits inside the slot (right), never on page chrome. */
  .vv-pav-anchor { top: 2px !important; }
  /* Pages whose own header already carries the avatar: no duplicate floating avatar. */
  body.vv-brokerage-desk .vv-pav-anchor, body.vv-mobile-vistasign-hub .vv-pav-anchor { display: none !important; }

  /* ---------- Consumer My Home ---------- */
  .vv-consumer-dash .vv-dash-trends {
    display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important;
    padding: 8px 12px !important; margin: 0 !important; height: auto !important;
  }
  .vv-consumer-dash .vv-dash-trends > * {
    display: flex !important; align-items: center; justify-content: space-between; gap: 6px;
    min-width: 0; margin: 0 !important; padding: 8px 10px !important; border-radius: 12px;
    background: rgba(20,38,31,.72); border: 1px solid rgba(212,175,55,.35);
    font-size: 12px !important; line-height: 1.25; color: #F5EBD0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .vv-homehub-topbar { flex-wrap: wrap !important; row-gap: 8px !important; align-items: center !important; }
  .vv-homehub-top-actions { flex-wrap: nowrap !important; gap: 8px !important; min-width: 0; margin-left: auto; justify-content: flex-end !important; }
  .vv-homehub-top-actions .vv-homehub-secure { display: none !important; }
  .vv-homehub-top-actions > span, .vv-homehub-top-actions > a, .vv-homehub-top-actions > button { flex-shrink: 0; }
  .vv-homehub-top-actions .vv-homehub-empty {
    flex-shrink: 1 !important; min-width: 0; max-width: 110px; white-space: nowrap !important;
    overflow: hidden; text-overflow: ellipsis; font-size: 12px !important;
  }
  .vv-homehub-head, .vv-homehub-head > div { min-width: 0; max-width: 100%; }
  .vv-homehub-head h1 {
    font-size: clamp(24px, 7.4vw, 30px) !important; line-height: 1.15 !important;
    overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .vv-homehub, .vv-homehub-main { min-width: 0; max-width: 100%; }
  /* map / floor-plan cells: the cell title flows above its note instead of printing over it */
  .vv-homehub-split > div { display: flex !important; flex-direction: column !important; gap: 2px; min-height: 108px; height: auto !important; }
  .vv-homehub-split > div > * { position: static !important; transform: none !important; inset: auto !important; }
  .vv-homehub-split > div > h3 { order: -2; margin: 6px 8px 0 !important; }
  .vv-homehub-split > div > .vv-homehub-mapcap { order: -1; margin: 0 8px !important; }
  .vv-homehub-split > div > p { margin: 0 8px !important; }
  .vv-homehub-split > div > .vv-homehub-addplan { width: auto !important; max-width: calc(100% - 16px) !important; box-sizing: border-box !important; margin: 4px 8px 8px !important; flex: 1 1 auto; }
  .vv-homehub-split > div > a { margin: 4px 8px 8px !important; align-self: flex-start; }
  /* tab bar sits on the bottom edge (or directly on the cookie bar), Jessica V stays inside it */
  body.vv-my-dashboard-surface .vv-homehub-tabbar { bottom: 0 !important; padding-bottom: env(safe-area-inset-bottom, 0px) !important; }
  body.vv-my-dashboard-surface .vv-jessica-fab { bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important; }
  body.vv-my-dashboard-surface:has(> [class*="z-[100000]"]) .vv-homehub-tabbar { bottom: var(--vv-cookie-h, 52px) !important; padding-bottom: 0 !important; }
  body.vv-my-dashboard-surface:has(> [class*="z-[100000]"]) .vv-jessica-fab { bottom: calc(var(--vv-cookie-h, 52px) + 8px) !important; }
  /* content clears the fixed tab bar */
  .vv-consumer-dash .vv-dash-shell { padding-bottom: 96px !important; }

  /* ---------- VistaSign hub (phone extras; all-width hub rules are at the end of this file) ---------- */
  body.vv-mobile-vistasign-hub .vv-hub-round-actions { position: static !important; margin: 8px auto !important; }
  body.vv-mobile-vistasign-hub .vv-hub, body.vv-mobile-vistasign-hub .vv-hub-col { max-width: 100% !important; }
  body.vv-mobile-vistasign-hub .vv-hub-phone-nav { left: 0 !important; right: 0 !important; width: 100% !important; }
  body.vv-mobile-vistasign-hub .vv-hub { padding-bottom: 80px !important; }

  /* ---------- Agent desk ---------- */
  body.vv-agent-desk-app main, body.vv-agent-desk-app .vv-ad { padding-bottom: 120px !important; }
  body.vv-agent-desk-app .vv-ad__dock { background: #0B1F19 !important; }
  /* the app lifts the dock above the cookie bar; lift the Ask Jessica bar with it */
  body.vv-agent-desk-app:has(> [class*="z-[100000]"]) .vv-ad__jessica { bottom: calc(var(--vv-cookie-h, 52px) + 66px) !important; }

  /* ---------- Brokerage desk ---------- */
  body.vv-brokerage-desk .vv-bh { padding-bottom: 128px !important; }
}

/* All widths: VistaSign template tiles whose preview came back empty show a clean page tile, not a broken image. */
.vv-hub-template-shot:has(> img[src="data:image/png;base64,"]) {
  background: linear-gradient(180deg, #FBF6E8 0%, #F1E6C8 100%);
  position: relative;
}
.vv-hub-template-shot:has(> img[src="data:image/png;base64,"])::after {
  content: ""; position: absolute; left: 18%; right: 18%; top: 22%; height: 46%;
  background: repeating-linear-gradient(180deg, rgba(20,38,31,.28) 0 2px, transparent 2px 10px);
}
.vv-hub-template-shot > img[src="data:image/png;base64,"] { visibility: hidden !important; }

/* VistaSign hub / inbox view, ALL widths: the editor preview, its tool rail and the SMS/WhatsApp send strip
   stacked above the hub. Hidden only while the hub path is showing AND no document is open; the moment a PDF
   is loaded (react-pdf document / page stack / continuous view / canvas) the :has() guard fails and they return. */
html.vv-vs-p7-hub:not(:has(.react-pdf__Document, .vv-vs-p0-pages, [data-vv-vistasign-continuous], [data-vv-vistasign-canvas])) body > .vv-vs-p6-rail,
html.vv-vs-p7-hub:not(:has(.react-pdf__Document, .vv-vs-p0-pages, [data-vv-vistasign-continuous], [data-vv-vistasign-canvas])) body > .vv-vs-p6-shell,
html.vv-vs-p7-hub:not(:has(.react-pdf__Document, .vv-vs-p0-pages, [data-vv-vistasign-continuous], [data-vv-vistasign-canvas])) .vv-vs-p2-phone-wrap,
html.vv-vs-p7-hub:not(:has(.react-pdf__Document, .vv-vs-p0-pages, [data-vv-vistasign-continuous], [data-vv-vistasign-canvas])) .vv-vs-p2-toggles { display: none !important; }
html.vv-vs-p7-hub:not(:has(.react-pdf__Document, .vv-vs-p0-pages, [data-vv-vistasign-continuous], [data-vv-vistasign-canvas])) body { padding-left: 0 !important; }
/* Trust chip row: sits in the page flow under the cards instead of a sticky strip printed over them. */
html.vv-vs-p7-hub .vv-hub-foot { position: static !important; bottom: auto !important; z-index: auto !important; margin-top: 12px !important; }
/* Empty QR payload: do not print a broken image with alt text; the caption under it still explains the phone link. */
img.vv-hub-qr[src="data:image/png;base64,"] { display: none !important; }
/* VistaSign hub header already carries the avatar menu; the floating avatar sat on its menu button. */
html.vv-vs-p7-hub .vv-pav-anchor { display: none !important; }

/* ╔═══════════════════════════════════════════════════════════════════════════╗
   ║ offshore-cursor-agent · 2026-09-28 · Feature: VistaSign CSS cleanup
   ║ Change: hide the legacy VistaSign page rail, chips, and phone strip when
   ║         the new hub or the new editor canvas is showing.
   ║ Prior : public/vv746-phone-fix.css ended before this block (9184 bytes).
   ║ Why   : live dist serves this cleanup. A fresh build must copy the same rules.
   ╚═══════════════════════════════════════════════════════════════════════════╝ */
/* vsfix 2026-09-28 (Boss 11:51 + 11:52 CT, additive). The Sep-22 legacy layers (p1 page rail + page chips, p6 tools rail +
   sticky "Upload PDF" shell) still ride the shell-tips payload on the new-build shells. The new hub and the new editor
   draw their own page list, toolbar and pager, so the legacy copies stacked on top of them.
   Hub (p7 marks html.vv-vs-p7-hub): the hub never shows pages, so the "PAGES" rail and the "1 2 3" chips are hidden. */
html.vv-vs-p7-hub .vv-vs-p1-thumbs,
html.vv-vs-p7-hub .vv-vs-p1-chips { display: none !important; }
/* New editor with its own canvas holding a loaded PDF: hide the duplicate legacy rail/shell/pager and the rail gutter.
   With no document (upload state or a failed load) the :has() guard fails and the legacy upload shell stays. */
html:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) body > .vv-vs-p6-shell,
html:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) body > .vv-vs-p6-rail,
html:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) .vv-vs-p1-thumbs,
html:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) .vv-vs-p1-chips,
/* Legacy SMS/WhatsApp strip: it slid under the editor header; the editor's own Share / Send flow covers it. */
html:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) .vv-vs-p2-phone-wrap,
html:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) .vv-vs-p2-toggles { display: none !important; }
html.vv-vs-p6-has-rail:not(.vv-vs-p7-hub):has([data-vv-vistasign-canvas] .react-pdf__Document) body { padding-left: 0 !important; }
