/* vj-instance.css: VJ instance layer (VJ port, Claude, 23 Nov 2026).
   Hand-written, VJ-only. index.php loads it after every Madalena sheet and after the generated vj-rebrand.css, and
   before vj-theme.css (tokens only). It replaces the "VJ instance (S2) vj.css" block that the old build appended to
   assets/materialize-madalena.css (that sheet is now the Madalena copy, shared verbatim), and it holds every style that
   the Madalena index.php writes inline: bootstrap.php sends CSP style-src 'self', so a <style> block or a style=""
   attribute in the markup is ignored by the browser. Every rule is scoped to body[data-instance="vj"] (set statically on
   <body> in index.php), so hidden blocks are hidden before any script runs. */

/* 1. Views VJ keeps in the DOM but never shows (second lock; admin.js pageTitles no longer lists them). The Portaria,
   Fechaduras, Códigos, Contas, Pagamentos, Backup and Anastácio views are not shipped at all; Consultas stays in the
   markup (Airbnb inquiries are platform messages, shown in Mensagens) but has no menu entry. */
body.rm-admin[data-instance="vj"] .view[data-page="locks"],
body.rm-admin[data-instance="vj"] .view[data-page="inquiries"],
body.rm-admin[data-instance="vj"] .view[data-page="accounts"],
body.rm-admin[data-instance="vj"] .view[data-page="payments"],
body.rm-admin[data-instance="vj"] .view[data-page="parking"],
body.rm-admin[data-instance="vj"] .view[data-page="faces"],
body.rm-admin[data-instance="vj"] .view[data-page="activity"],
body.rm-admin[data-instance="vj"] .view[data-page="codes"],
body.rm-admin[data-instance="vj"] .view[data-page="backup"] { display: none !important; }

/* 2. Reservation dialog: Madalena-only blocks. The apartment access codes ("Acesso ao apartamento" title and panels), the
   people/identification received by the check-in and the visitor slots card, the guest-area (check-in) link button, the
   guest WhatsApp button, the direct-booking actions and the visitor-fallback dialog. Guest, stay card, finance,
   conversation, reviews and Fechar stay. (Madalena 23 Nov moved the cards into .checkin-scroll-region.) */
body.rm-admin[data-instance="vj"] #checkin-form .checkin-scroll-region > h3.reservation-section-title,
body.rm-admin[data-instance="vj"] #checkin-reservation-codes,
body.rm-admin[data-instance="vj"] #checkin-form .checkin-scroll-region > .checkin-feature-card,
body.rm-admin[data-instance="vj"] #checkin-visitors-panel,
body.rm-admin[data-instance="vj"] #checkin-copy-link,
body.rm-admin[data-instance="vj"] #checkin-whatsapp,
body.rm-admin[data-instance="vj"] #direct-reservation-actions,
body.rm-admin[data-instance="vj"] #checkin-default-modal { display: none !important; }

/* 3. Conversation and Mensagens: WhatsApp-only controls, in case a renderer still writes them. */
body.rm-admin[data-instance="vj"] .chat-identity-whatsapp,
body.rm-admin[data-instance="vj"] #guesty-chat-invite,
body.rm-admin[data-instance="vj"] #wl-chat,
body.rm-admin[data-instance="vj"] [data-open-broadcast],
body.rm-admin[data-instance="vj"] [data-messages-filter="whatsapp"],
body.rm-admin[data-instance="vj"] [data-direct-ui] { display: none !important; }

/* 4. Integrações: the static Guesty card (VJ reads reservations from Channex). Configurações: the VJ notice. */
body.rm-admin[data-instance="vj"] .integration-card:has(#guesty-sync-time) { display: none !important; }
body.rm-admin[data-instance="vj"] .vj-settings-notice { margin-top: 0; }

/* 5. Reservas table (9 columns since Madalena 14 Oct: Unidade, Hóspede, Check-in, Checkout, Vagas, Cód. temp., Cadastro,
   Tipo, Reserva). VJ has no Vagas, Código temporário or Cadastro, so columns 5-7 are not shown: on a computer the cells
   and their <col> leave the table (the month and empty rows must span the 6 visible columns); on phone cards the three
   grid areas stay empty. Tipo (8) and Reserva (9) and the row tap keep working. */
@media (min-width: 781px) {
  body.rm-admin[data-instance="vj"] .reservation-table col:nth-child(5),
  body.rm-admin[data-instance="vj"] .reservation-table col:nth-child(6),
  body.rm-admin[data-instance="vj"] .reservation-table col:nth-child(7),
  body.rm-admin[data-instance="vj"] .reservation-table th:nth-child(5),
  body.rm-admin[data-instance="vj"] .reservation-table th:nth-child(6),
  body.rm-admin[data-instance="vj"] .reservation-table th:nth-child(7) { display: none; }
  /* Audit m7: the shared base sheet sizes the 9-column table at 1180 px (14 Oct Tipo column); with 6 visible columns
     VJ fits ~860 px, so a 1440 px screen shows the whole table (live VJ: 1092 px). Consultas (8 columns, all shown,
     view hidden on VJ) gets the base sheet's pre-Tipo width instead of the 9-column one. */
  body.rm-admin[data-instance="vj"] .reservation-table { min-width: 860px; }
  body.rm-admin[data-instance="vj"] .reservation-table.inquiry-table { min-width: 980px; }
}
body.rm-admin[data-instance="vj"] .reservation-table tbody td:nth-child(5),
body.rm-admin[data-instance="vj"] .reservation-table tbody td:nth-child(6),
body.rm-admin[data-instance="vj"] .reservation-table tbody td:nth-child(7) { display: none !important; }
/* Imóveis table: VJ ships no Fechadura column (its <col>/<th> are not in the markup); a lock cell a renderer still writes
   leaves the table instead of shifting the other columns. */
body.rm-admin[data-instance="vj"] .pms-property-table td.pms-prop-lock { display: none !important; }

/* 6. Logo: the VJ monogram is an SVG with its own ratio (96:62), so it is sized by height (DESIGN-VJ §3: minimum 24 px;
   sidebar tile 44 px as in the VJ prototype). */
body.rm-admin[data-instance="vj"] .brand-tile img { width: auto; height: 44px; }
body.rm-admin[data-instance="vj"] .login-brand img { width: auto; height: 72px; }

/* 6b. BOOT-splash (Madalena 24 Oct) with the VJ mark: the dark-surface VJ logo (light strokes; audit m6: the light-surface
   file's dark J was ~1.2:1 on the violet splash) is the image and the mask of the one accent sheen
   (Madalena masks with logo-madalena-white.png). The violet background, lights and the accent line come from
   vj-rebrand.css (generated from the Madalena splash colours). */
body.rm-admin[data-instance="vj"] #boot-loader .loader-brand { width: auto; height: 88px; }
body.rm-admin[data-instance="vj"] #boot-loader .loader-brand img { display: block; width: auto; height: 88px; margin: 0 auto; }
body.rm-admin[data-instance="vj"] #boot-loader .loader-brand::after {
  -webkit-mask: url("brand/vj-logo-dark.svg?v=3c8545c2b9") center / contain no-repeat;
  mask: url("brand/vj-logo-dark.svg?v=3c8545c2b9") center / contain no-repeat;
}

/* 7. Token aliases read by the VJ layer that vj-theme.css does not declare (it declares --vj-surface-2 and --vj-body). */
:root,
body.rm-admin { --vj-surface2: var(--vj-surface-2); --vj-body-rgb: 246, 245, 249; }

/* 8. Hand-written additions (not derived from a Madalena colour literal). Avatars, current-stay unit badges and the chat
   rail draw initials in white on the accent gradient; Madalena's gold tolerated that, VJ picks the readable ink per theme
   (--vj-on-accent). */
body.rm-admin[data-instance="vj"] .message-thread-avatar,
body.rm-admin[data-instance="vj"] .guesty-chat-avatar,
body.rm-admin[data-instance="vj"] .guesty-chat-rail-avatar,
body.rm-admin[data-instance="vj"] .search-result.is-current .search-result-unit { color: var(--vj-on-accent); }
@media (max-width: 780px) {
  body.rm-admin[data-instance="vj"] .reservation-table tbody tr.current-stay td:nth-child(1) .cell-primary { color: var(--vj-on-accent) !important; }
  body.rm-admin[data-instance="vj"] .reservation-table tbody td:nth-child(3)::after { color: var(--vj-on-accent); }
}
/* Chat wallpaper: the Madalena doodles (assets/chat-pattern.svg) are replaced by the neutral VJ tile, which lives in
   assets/ (the old override pointed at assets/brand/ and 404ed). */
body.rm-admin[data-instance="vj"] .guesty-chat-list { background-image: url("chat-pattern-vj.svg?v=05189a171c"); }
/* The Admin paints the top-level canvas on <html> from admin.css :root; keep overscroll in the theme canvas. */
html:has(> body[data-instance="vj"]) { background: var(--vj-body, #f6f5f9); }
/* Análises month rings: the SVG presentation colours are Madalena navy in the markup; CSS wins over the attribute. */
body.rm-admin[data-instance="vj"] .analytics-ring-track { stroke: var(--vj-p50); }
body.rm-admin[data-instance="vj"] #analytics-today-ring { stroke: var(--vj-p800); }
body.rm-admin[data-instance="vj"] #analytics-month-ring { stroke: var(--vj-p600); }

/* 9. Styles the Madalena index.php writes inline (blocked by CSP style-src 'self'), moved here. */
/* LOGOUT-sidebar (Madalena 22 Nov 2026): Sair sits at the end of the sidebar footer. */
body.rm-admin[data-instance="vj"] .sidebar-footer { grid-template-columns: 40px minmax(0, 1fr) auto; }
body.rm-admin[data-instance="vj"] .sidebar-footer .sidebar-logout { justify-self: end; }
body.rm-admin[data-instance="vj"] .app-shell.sidebar-collapsed .sidebar-footer > div:nth-child(2) { display: none; }
body.rm-admin[data-instance="vj"] .app-shell.sidebar-collapsed .sidebar-footer .sidebar-logout { justify-self: center; }
/* MODAL-vv2 (Madalena 22 Nov 2026): on phones an open dialog's dimmed layer extends past its box, so a stale iOS
   viewport never leaves an undimmed band, and the layer does not drag the page. (The J-modal-scroll rule of
   materialize-madalena.css, more specific, still sets the opaque #787a83 spread on most dialogs, as on Madalena.) */
@media (max-width: 780px) {
  body[data-instance="vj"] > .modal:not(#guesty-chat-modal):not(.hidden) { box-shadow: 0 0 0 100vmax rgba(var(--vj-p950-rgb), .62); overscroll-behavior: contain; }
}
/* Imóvel page: the address line under the banner title and the two collapsible sections. */
body.rm-admin[data-instance="vj"] #property-address-line { margin: 8px 0; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
body.rm-admin[data-instance="vj"] .property-photos-details > summary.card-head,
body.rm-admin[data-instance="vj"] .property-settings-details > summary.card-head { cursor: pointer; }

/* 10. Integrator (23 Nov 2026): the calendar bar mark of a manual/"Direto" stay (calendarStayIcon -> .calendar-channel-logo
   .is-direct). Madalena's calendar-dnd.css points it at logo-madalena-square.png, which VJ does not ship (404 + blank
   mark); the VJ square icon replaces it, so the Madalena URL is never requested. */
body.rm-admin[data-instance="vj"] .calendar-channel-logo.is-direct { background-image: url("brand/vj-icon.svg"); background-size: cover; }

/* Staging check 23 Nov 2026 (Claude): VJ is Airbnb-only. The Imóveis channel portal strip keeps only the Airbnb link;
   the Booking.com / Expedia / Vrbo links and the unset Decolar editor button are hidden. */
#channel-portals a.channel-portal:not([href*="airbnb"]),
#channel-portals button.channel-portal { display: none !important; }
