/* Shared mobile layer. Desktop tables and widget markup remain unchanged. */
@media (max-width: 700px) {
    .bsv-responsive, .bsv-responsive body { min-width: 0; }
    .bsv-responsive { --portal-grid-header-font-size: 13px; }
    .bsv-responsive *, .bsv-responsive *::before, .bsv-responsive *::after { box-sizing: border-box; }
    .bsv-responsive .gc-workspace, .bsv-responsive .gc-main,
    .bsv-responsive main, .bsv-responsive .detalhe-page,
    .bsv-responsive .avcb-toolbar__primary { min-width: 0; }
    .bsv-responsive .gc-app { min-height: 100dvh; }
    .bsv-responsive .gc-main { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
    .bsv-responsive .gc-sidebar { max-width: calc(100vw - 44px); padding-top: max(22px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
    .bsv-responsive .gc-topbar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
    .bsv-responsive .gc-account__dropdown { width: min(260px, calc(100vw - 44px)); min-width: 0; }
    .bsv-responsive .gc-account__dropdown a { min-height: 44px; display: flex; align-items: center; white-space: normal; }
    .bsv-responsive .portal-current-environment, .bsv-responsive .gc-environment { width: 100%; min-width: 0; max-width: 100%; }
    .bsv-responsive .portal-current-environment strong, .bsv-responsive .portal-client-name { white-space: normal; overflow-wrap: anywhere; }
    .bsv-responsive .custom-block, .bsv-responsive .custom-filter,
    .bsv-responsive .vistoria-action-buttons, .bsv-responsive .vistoria-actions { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
    .bsv-responsive .custom-block { align-items: flex-start; }
    .bsv-responsive .custom-block h4 { margin-right: 0; overflow-wrap: anywhere; }
    .bsv-responsive .custom-filter > *, .bsv-responsive .custom-filter .e-input-group { max-width: 100%; }
    .bsv-responsive .custom-filter > .e-input-group { flex: 1 1 220px; width: 100% !important; }
    .bsv-responsive input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
    .bsv-responsive select, .bsv-responsive textarea { max-width: 100%; font-size: 16px !important; }
    .bsv-responsive input[type="search"], .bsv-responsive .login-input,
    .bsv-responsive .public-input, .bsv-responsive .client-selection-control select { min-height: 44px; }
    .bsv-responsive .e-btn, .bsv-responsive .detalhe-button,
    .bsv-responsive .avcb-html-expand, .bsv-responsive .atestados-html-expand,
    .bsv-responsive .galerias-expand, .bsv-responsive .modal-close { min-width: 44px; min-height: 44px; }
    .bsv-responsive [class$="html-button"], .bsv-responsive .galerias-button,
    .bsv-responsive .atestados-html-badge, .bsv-responsive .pdv2-tools button,
    .bsv-responsive .pv2 button { min-height: 44px; }
    .bsv-responsive .login-header__inner, .bsv-responsive .login-main,
    .bsv-responsive .login-footer__inner { width: calc(100% - 28px); }
    .bsv-responsive .login-form-card { padding: 26px 18px; }
    .bsv-responsive .login-shell { width: 100%; min-width: 0; }
    .bsv-responsive .login-info-card { padding-inline: 20px; min-height: 0; }
    .bsv-responsive .login-info-card__content { min-height: 0; }
    .bsv-responsive .login-info-card__copy { padding-right: 0; }
    .bsv-responsive .login-remember { align-items: center; min-height: 44px; }
    .bsv-responsive .login-links { display: flex; flex-wrap: wrap; gap: 12px; }
    .bsv-responsive .public-header__inner { flex-wrap: wrap; gap: 12px; padding-block: 10px; }
    .bsv-responsive .public-card, .bsv-responsive .client-selection-card { overflow-wrap: anywhere; }
    .bsv-responsive .client-selection-page { min-height: 100dvh; }
    .bsv-responsive .client-selection-header { flex-wrap: wrap; gap: 10px; }
    .bsv-responsive .client-selection-main { min-width: 0; }
    .bsv-responsive .client-selection-footer { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
    /* Legacy routes retain their layout, with a normal-flow footer and grids
       constrained to the content width instead of expanding the whole page. */
    .bsv-responsive .footer-fixo { position: static; height: auto; min-height: 50px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    .bsv-responsive body > .container { padding-bottom: 20px !important; }
    .bsv-responsive .navbar .container-fluid { flex-wrap: wrap; gap: 8px; }
    .bsv-responsive .navbar-nav { flex-wrap: wrap; }
    .bsv-responsive .parameters-page .card-body, .bsv-responsive .parameters-card { max-width: 100%; overflow-x: auto; }
    .bsv-responsive .e-grid { max-width: 100%; }
    .bsv-responsive .e-grid .e-toolbar .e-toolbar-items { min-width: 0; }
    .bsv-responsive .e-grid .e-toolbar .e-search-wrapper { min-width: 0 !important; }
    .bsv-responsive .e-grid .e-pager { white-space: normal; }
    .bsv-responsive .e-dialog { max-width: calc(100vw - 24px) !important; max-height: calc(100dvh - 24px); }
    .bsv-responsive .avcb-agenda-table-wrap, .bsv-responsive .vistoria-table-wrap,
    .bsv-responsive .itens-table-wrap { max-width: 100%; }
    /* Do not hide columns or duplicate rows: every field and action stays in
       its original cell. Header labels also cover lazy-loaded nested tables. */
    .bsv-responsive table.bsv-mobile-table { display: block; width: 100% !important; min-width: 0 !important; max-width: 100%; table-layout: auto; border: 0; }
    .bsv-responsive table.bsv-mobile-table > colgroup { display: none; }
    .bsv-responsive table.bsv-mobile-table > thead,
    .bsv-responsive table.bsv-mobile-table > tbody { display: block; width: 100%; }
    .bsv-responsive table.bsv-mobile-table > thead > tr:first-child { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .bsv-responsive table.bsv-mobile-table > thead > tr:not(:first-child) { display: grid; gap: 8px; padding: 12px; }
    .bsv-responsive table.bsv-mobile-table > thead th[data-mobile-filter="false"] { display: none; }
    .bsv-responsive table.bsv-mobile-table > thead th[data-mobile-filter="true"] { display: block; width: 100%; padding: 0; }
    .bsv-responsive table.bsv-mobile-table > thead th[data-mobile-filter="true"]::before { content: attr(data-mobile-label); display: block; margin-bottom: 4px; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr { display: block; margin: 12px 10px; padding: 4px 10px; border: 1px solid #d9dee7; border-radius: 10px; background: #fff; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr[hidden],
    .bsv-responsive table.bsv-mobile-table > tbody > tr > [hidden] { display: none !important; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr > td { display: grid; grid-template-columns: minmax(90px, 36%) minmax(0, 1fr); gap: 8px; align-items: start; width: auto !important; min-width: 0 !important; max-width: none; padding: 10px 0; text-align: left !important; white-space: normal !important; overflow-wrap: anywhere; font-size: 14px !important; line-height: 1.5 !important; border-bottom: 1px solid #edf0f5; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr > td::before { content: attr(data-mobile-label); color: #52617a; font-size: 12px; font-weight: 600; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr > td:last-child { border-bottom: 0; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr[data-mobile-spanning="true"] { padding: 0; border: 0; background: transparent; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr[data-mobile-spanning="true"] > td { display: block; padding: 8px 0; background: transparent; }
    .bsv-responsive table.bsv-mobile-table > tbody > tr[data-mobile-spanning="true"] > td::before { content: none; }
    .bsv-responsive table.bsv-mobile-table td > * { grid-column: 2; min-width: 0; max-width: 100%; }
    .bsv-responsive table.bsv-mobile-table td a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
    .bsv-responsive table.bsv-mobile-table td a:has(img),
    .bsv-responsive table.bsv-mobile-table td a.avcb-html-link,
    .bsv-responsive table.bsv-mobile-table td a.training-html-link { display: inline-flex; align-items: center; min-height: 44px; }
    .bsv-responsive .avcb-html-pagination > div, .bsv-responsive .atestados-html-pagination > div,
    .bsv-responsive .training-html-pagination > div, .bsv-responsive .galerias-pagination > div,
    .bsv-responsive .evidence-html-pagination > div { display: flex; flex-wrap: wrap; gap: 8px; }
    .bsv-responsive .vistoria-basicos { position: static; }
    .bsv-responsive .vistoria-heading, .bsv-responsive .vistoria-subtitle { overflow-wrap: anywhere; }
    .bsv-responsive .projetos-dropdown-menu { min-width: 0; width: min(300px, calc(100vw - 52px)); max-width: calc(100vw - 52px); left: 0; right: auto; }
    .bsv-responsive .planta-modal, .bsv-responsive .foto-modal,
    .bsv-responsive .detalhe-modal { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100dvh - 24px); }
    .bsv-responsive .planta-modal { height: calc(100dvh - 24px); }
    .bsv-responsive .modal-header { flex-wrap: wrap; gap: 8px; }
    .bsv-responsive .projeto-pdf-tools, .bsv-responsive .pdv2-tools,
    .bsv-responsive .pv2-tools { flex-wrap: wrap; gap: 8px; }
    .bsv-responsive .pdv2-tools select, .bsv-responsive .pv2 select { width: 100%; min-width: 0; }
    .bsv-responsive .pv2-stage, .bsv-responsive .pdv2-stage { height: 50dvh; min-height: 240px; }
    .bsv-responsive .pdv2-main, .bsv-responsive .pdv2.is-item-list-open .pdv2-main { min-height: 0; }
}
@media print {
    .bsv-responsive .bsv-pwa-banner { display: none !important; }
}
