/* Capa táctil compartida. Mantener el mismo punto de corte en bcm_mobile.js. */
.bcm-mobile-brand, .bcm-mobile-access-toggle, .bcm-mobile-menu-label,
.bcm-mobile-shade, .bcm-mobile-scroll-help, .bcm-mobile-fields-toggle { display: none; }
.bcm-mobile-table-wrap { display: contents; }

@media screen and (max-width: 1023px) {
    html { scroll-padding-top: 72px; }
    body.bcm-mobile-ready { --bcm-mobile-top: 56px; }
    body.bcm-mobile-ready section.content { margin-left: 0 !important; min-width: 0; }
    body.bcm-mobile-ready .wraper.container-fluid,
    body.bcm-mobile-ready .warper.container-fluid { width: 100% !important; min-width: 0 !important; padding: 68px 12px 88px !important; }
    body.bcm-mobile-ready .content > .container-fluid > .row { margin-left: -6px; margin-right: -6px; }
    body.bcm-mobile-ready .content > .container-fluid > .row > [class*="col-"] { padding-left: 6px; padding-right: 6px; }
    body.bcm-mobile-ready .page-title .title { font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
    body.bcm-mobile-ready .panel-heading, body.bcm-mobile-ready .panel-body { padding: 12px; }
    body.bcm-mobile-ready .panel { border-radius: 8px; }
    body.bcm-mobile-ready .panel-heading > .btn-group.pull-right { display: inline-flex; width: auto !important; margin: 0 6px 8px 0 !important; }

    /* Una sola franja; los mismos accesos y permisos existentes se despliegan debajo. */
    body.bcm-mobile-ready header.top-head {
        position: fixed; inset: 0 0 auto; width: 100%; height: var(--bcm-mobile-top); min-height: var(--bcm-mobile-top);
        display: flex; align-items: center; gap: 8px; padding: 4px 12px; z-index: 1036;
        box-shadow: 0 2px 8px rgb(0 50 90 / 15%);
    }
    body.bcm-mobile-ready header.top-head .bcm-menu-switch {
        display: inline-flex; align-items: center; justify-content: center; gap: 7px;
        float: none !important; height: 48px; min-width: 76px; margin: 0; padding: 0 6px; color: #fff;
    }
    body.bcm-mobile-ready .bcm-menu-switch-track { display: none; }
    body.bcm-mobile-ready .bcm-mobile-menu-label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
    body.bcm-mobile-ready .bcm-mobile-menu-label::before { content: "☰"; font-size: 23px; line-height: 1; }
    body.bcm-mobile-menu-open .bcm-mobile-menu-label::before { content: "×"; }
    body.bcm-mobile-ready .bcm-mobile-brand { display: flex; align-items: center; min-height: 44px; color: #fff; font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; text-decoration: none; border-radius: 4px; }
    body.bcm-mobile-ready .bcm-mobile-brand:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
    body.bcm-mobile-ready .bcm-mobile-access-toggle {
        display: inline-flex; align-items: center; justify-content: center; gap: 7px;
        color: #fff; background: rgb(255 255 255 / 13%); border: 1px solid rgb(255 255 255 / 32%);
        border-radius: 8px; min-height: 44px; padding: 0 12px; font-weight: 500;
    }
    body.bcm-mobile-ready .bcm-mobile-access-toggle::after { content: "⌄"; font-size: 20px; }
    body.bcm-mobile-access-open .bcm-mobile-access-toggle::after { content: "×"; }
    body.bcm-mobile-ready header.top-head > nav { position: static; }
    body.bcm-mobile-ready header.top-head .top-menu { display: none; }
    body.bcm-mobile-access-open header.top-head .top-menu {
        display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; position: absolute;
        top: 56px; left: 8px; right: 8px; height: auto; max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px);
        margin: 0; padding: 12px; background: #006abd; border-radius: 0 0 12px 12px;
        overflow-y: auto; overscroll-behavior-y: contain; box-shadow: 0 8px 24px rgb(0 35 65 / 25%);
    }
    body.bcm-mobile-ready header.top-head .top-menu > li { flex: 1 1 140px; padding: 0; margin: 0; text-align: left; min-width: 0; }
    body.bcm-mobile-ready header.top-head .top-menu > li.bcm-mobile-empty { display: none; }
    body.bcm-mobile-ready header.top-head .top-menu > li > a,
    body.bcm-mobile-ready header.top-head .top-menu > li > button {
        display: flex; align-items: center; width: 100%; height: auto !important; min-height: 48px;
        padding: 10px 12px !important; margin: 0; font-size: 15px; line-height: 1.4; border-radius: 6px;
        background: rgb(255 255 255 / 9%); white-space: normal; text-align: left;
    }
    body.bcm-mobile-ready header.top-head .top-menu > li.open { flex-basis: 100%; }
    body.bcm-mobile-ready header.top-head .top-menu .dropdown-menu {
        position: static !important; float: none; width: 100% !important; min-width: 0;
        max-height: none; margin: 4px 0 0; border: 0; box-shadow: none; background: #fff;
    }
    body.bcm-mobile-ready header.top-head .top-menu .dropdown-menu li { display: block; }
    body.bcm-mobile-ready header.top-head .top-menu .dropdown-menu a { height: auto; min-height: 44px; padding: 12px; white-space: normal; line-height: 1.4; }
    body.bcm-mobile-ready .bcm-new-window-label, body.bcm-mobile-ready .username { display: inline; }

    /* El cajón usa scroll nativo y no empuja el contenido ni recuerda aperturas móviles. */
    body.bcm-mobile-ready #asidemenu.left-panel {
        position: fixed; top: 56px; bottom: 0; left: 0; width: min(320px, calc(100vw - 48px));
        height: auto !important; min-height: 0; z-index: 1035; transform: translateX(-105%);
        visibility: hidden; overflow: hidden !important; background: #fff; padding: 0;
    }
    body.bcm-mobile-menu-open #asidemenu.left-panel { transform: translateX(0); visibility: visible; box-shadow: 8px 0 24px rgb(20 40 60 / 15%); }
    body.bcm-mobile-ready #asidemenu .logo { display: none; }
    body.bcm-mobile-ready #asidemenu nav.navigation {
        height: 100%; margin: 0 !important; padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
        overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
    }
    body.bcm-mobile-ready #asidemenu nav.navigation > ul > li > a {
        display: flex; align-items: center; min-height: 48px; gap: 10px; padding: 12px 18px;
        color: #344958; white-space: normal; font-size: 15px; line-height: 1.4;
    }
    body.bcm-mobile-ready #asidemenu .nav-label { display: inline !important; }
    body.bcm-mobile-ready #asidemenu .bcm-menu-drag-handle, body.bcm-mobile-ready #asidemenu .bcm-menu-legacy-letter { display: none !important; }
    body.bcm-mobile-ready #asidemenu nav.navigation > ul > li > a > i { margin: 0 !important; width: 22px; font-size: 19px; }
    body.bcm-mobile-ready #asidemenu li.has-submenu::after { display: none; }
    body.bcm-mobile-ready #asidemenu .menu-arrow { display: block !important; margin-left: auto; }
    body.bcm-mobile-ready #asidemenu nav.navigation > ul > li > ul {
        display: none !important; position: static !important; width: auto; min-width: 0 !important;
        margin: 0 12px 8px; padding: 4px; border: 0; background: #f1f6fa; box-shadow: none;
    }
    body.bcm-mobile-ready #asidemenu nav.navigation > ul > li.bcm-mobile-submenu-open > ul { display: block !important; }
    body.bcm-mobile-ready #asidemenu nav.navigation > ul > li > ul a { min-height: 44px; padding: 12px 16px !important; white-space: normal !important; line-height: 1.4; }
    body.bcm-mobile-ready .bcm-mobile-shade { position: fixed; inset: 56px 0 0; z-index: 1030; background: rgb(14 30 45 / 42%); border: 0; width: 100%; }
    body.bcm-mobile-menu-open .bcm-mobile-shade, body.bcm-mobile-access-open .bcm-mobile-shade { display: block; }
    body.bcm-mobile-menu-open, body.bcm-mobile-access-open { overflow: hidden !important; }
    body.bcm-mobile-ready .bcm-capture-fab { z-index: 1025; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; }
    body.bcm-mobile-ready.modal-open .bcm-capture-fab, body.bcm-mobile-keyboard .bcm-capture-fab { display: none !important; }

    /* Controles cómodos, conservando el zoom nativo y los editores de tabla. */
    body.bcm-mobile-ready .content .btn, body.bcm-mobile-ready .modal .btn { min-height: 44px; min-width: 44px; white-space: normal; font-size: 14px; line-height: 1.35; padding: 10px 12px; }
    body.bcm-mobile-ready .form-control { min-height: 44px; font-size: 16px; }
    body.bcm-mobile-ready textarea.form-control { height: auto; min-height: 88px; resize: vertical; }
    body.bcm-mobile-ready .select2-container .select2-choice { min-height: 44px; line-height: 42px; font-size: 16px; }
    body.bcm-mobile-ready .select2-container .select2-choices { min-height: 44px; font-size: 16px; }
    body.bcm-mobile-ready .modal-dialog { width: auto !important; max-width: calc(100% - 16px) !important; margin: 8px auto; }
    body.bcm-mobile-ready .modal-content { border-radius: 12px; }
    body.bcm-mobile-ready .modal-header { padding: 12px 16px; }
    body.bcm-mobile-ready .modal-header .close { opacity: 1; min-width: 44px; min-height: 44px; margin-top: -10px; margin-right: -10px; font-size: 28px; }
    body.bcm-mobile-ready .modal-body { padding: 14px; overflow-wrap: anywhere; }
    body.bcm-mobile-ready .modal-footer { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
    body.bcm-mobile-ready .modal-footer .btn { flex: 1 1 auto; margin: 0; }
    body.bcm-mobile-ready .nav-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; }
    body.bcm-mobile-ready .nav-tabs > li { float: none; flex: 0 0 auto; }
    body.bcm-mobile-ready .nav-tabs > li > a { min-height: 44px; }
    body.bcm-mobile-ready :is(button, a, input, select, textarea):focus-visible { outline: 3px solid #e2a400; outline-offset: 2px; }
    body.bcm-mobile-ready .footer { position: static; width: 100%; padding: 12px; }

    /* El gesto horizontal queda en la tabla; el vertical conserva su comportamiento nativo. */
    body.bcm-mobile-ready .bcm-mobile-table-wrap { display: block; width: 100%; overflow: auto; }
    body.bcm-mobile-ready .bcm-mobile-scroll-region { max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: auto; }
    body.bcm-mobile-ready .bcm-mobile-scroll-help:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; padding: 5px; border: 1px solid #d6e5ef; border-radius: 8px; background: #eef6fc; color: #315b77; font-size: 12px; }
    body.bcm-mobile-ready .bcm-mobile-scroll-help button { flex: 0 0 44px; width: 44px; min-height: 44px; border: 1px solid #bad4e6; border-radius: 6px; background: #fff; color: #086da9; font-size: 22px; }
    body.bcm-mobile-ready .bcm-mobile-scroll-help button:disabled { opacity: .35; }
    body.bcm-mobile-ready .bcm-mobile-scroll-help span { text-align: center; }
    body.bcm-mobile-ready .dataTables_wrapper .dataTables_filter,
    body.bcm-mobile-ready .dataTables_wrapper .dataTables_length { float: none; text-align: left; margin: 8px 0; }
    body.bcm-mobile-ready .dataTables_filter input { max-width: 100%; min-height: 44px; font-size: 16px; }
    body.bcm-mobile-ready .dataTables_wrapper .dataTables_paginate { float: none; text-align: center; white-space: normal; }
    body.bcm-mobile-ready .dataTables_wrapper .dataTables_paginate .paginate_button { min-height: 44px; min-width: 44px; }
    body.bcm-mobile-ready .pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
    body.bcm-mobile-ready .pagination > li > a { min-height: 44px; min-width: 44px; }

    /* Resumen Proyectos: los campos disponibles se abren cuando se necesitan. */
    body.bcm-mobile-ready .bcm-vc-layout { display: block !important; }
    body.bcm-mobile-ready .bcm-vc-fields, body.bcm-mobile-ready .bcm-vc-grid-wrap { width: 100% !important; min-width: 0; }
    body.bcm-mobile-ready .bcm-mobile-fields-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; margin-bottom: 8px; background: #fff; border: 1px solid #c9dbe7; color: #315b77; border-radius: 6px; }
    body.bcm-mobile-ready .bcm-mobile-fields-toggle::after { content: "+"; font-size: 22px; }
    body.bcm-mobile-ready .bcm-mobile-fields-toggle[aria-expanded="true"]::after { content: "−"; }
    body.bcm-mobile-ready .bcm-vc-fields.bcm-mobile-fields-closed { display: none !important; }
    body.bcm-mobile-ready .bcm-vc-toolbar-left { gap: 8px; }
    body.bcm-mobile-ready #bcmProjectFieldSearch { width: 100% !important; flex: 1 0 100%; margin: 0; }
    body.bcm-mobile-ready #bcmProjectReload, body.bcm-mobile-ready #bcmProjectClearFilters { width: auto !important; flex: 1 1 auto; margin: 0; }
    body.bcm-mobile-ready .bcm-vc-heading, body.bcm-mobile-ready .bcm-project-heading-actions { flex-wrap: wrap; gap: 8px; }
    body.bcm-mobile-ready .bcm-vc-scroll-main { max-height: 66vh; max-height: 66dvh; overflow-y: auto !important; }
    body.bcm-mobile-ready .bcm-vc-scroll-top { display: none; }
    body.bcm-mobile-ready .bcm-vc-table :is(input:not([type="checkbox"]), select, textarea, [contenteditable="true"]) { font-size: 16px !important; min-height: 44px !important; }
    body.bcm-mobile-ready table thead th.bcm-table-header-cell .bcm-table-header-button { width: 36px !important; min-width: 36px !important; max-width: 36px !important; height: 44px !important; min-height: 44px !important; max-height: 44px !important; }
    body.bcm-mobile-ready table thead th.bcm-table-header-cell { min-height: 52px; padding-right: 86px !important; }
    body.bcm-mobile-ready table thead th.bcm-table-header-cell > .bcm-table-header-button { margin-top: -22px !important; }
    body.bcm-mobile-ready table thead th.bcm-table-header-cell > .bcm-table-header-sort,
    body.bcm-mobile-ready table thead th.bcm-table-header-cell .bcm-common-sort-button { right: 46px !important; }
    body.bcm-mobile-ready table thead th.bcm-table-header-cell > .bcm-contact-header-tools { width: 84px !important; }
    body.bcm-mobile-ready #datatableproyectoscampos thead th.bcm-project-freezable { padding: 10px 8px 54px !important; width: var(--bcm-mobile-column-width, 136px) !important; min-width: 136px !important; max-width: none !important; }
    body.bcm-mobile-ready #datatableproyectoscampos thead th.bcm-project-freezable .bcm-table-header-button { top: auto !important; bottom: 4px !important; margin-top: 0 !important; }
    body.bcm-mobile-ready #datatableproyectoscampos thead th .bcm-vc-freeze-button { right: 87px !important; }
    body.bcm-mobile-ready .bcm-vc-filter-menu { position: fixed !important; top: 68px !important; left: 12px !important; right: 12px; width: auto !important; min-width: 0; min-height: 0; max-height: calc(100dvh - 84px); resize: none; }
    body.bcm-mobile-ready .bcm-vc-filter-menu :is(button, .btn, label) { min-height: 44px; padding: 10px 8px; }
    body.bcm-mobile-ready .bcm-vc-filter-value-list { height: auto; max-height: 40dvh; }
    body.bcm-mobile-ready .bcm-vc-field-option { min-height: 44px; }
    body.bcm-mobile-ready #datatabletarea :is(th, td):nth-child(3) { min-width: 220px; }
    body.bcm-mobile-ready #datatabletarea :is(th, td):nth-child(5) { min-width: 200px; }
}

@media print {
    .bcm-mobile-brand, .bcm-mobile-access-toggle, .bcm-mobile-menu-label,
    .bcm-mobile-shade, .bcm-mobile-scroll-help, .bcm-mobile-fields-toggle { display: none !important; }
}
