/* ==========================================================================
   mobile.css — WorkPlan-Pro Responsive Styles
   Complementa style.css y sidebar.css con ajustes por módulo.
   Breakpoints: ≤1199px (laptop), ≤1023px (tablet), ≤767px (móvil), ≤479px (móvil pequeño)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BASE — Mejoras globales de accesibilidad táctil
   -------------------------------------------------------------------------- */

* {
  -webkit-tap-highlight-color: transparent;
}

input[type="date"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  font-size: 16px !important; /* Evita zoom automático en iOS */
}

/* --------------------------------------------------------------------------
   2. TOPBAR — Enhancements
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 300;
  }

  .topbar .topbar-right {
    gap: 6px;
  }

  /* Ocultar textos de botones en topbar, dejar solo íconos */
  .topbar .btn span.btn-text {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   3. LAYOUT — Wrap y contenedores principales
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .wrap {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0;
  }

  .app-section {
    gap: 10px;
  }

  .panel.inner,
  .panel-inner {
    padding: 10px;
    border-radius: 12px;
  }

  .inner-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .inner-head h3 {
    font-size: 13px;
  }

  .hint {
    font-size: 10px;
  }
}

@media (max-width: 479px) {
  .wrap {
    padding: 8px 8px;
    padding-bottom: calc(80px + var(--safe-area-bottom));
  }
}

/* --------------------------------------------------------------------------
   4. NAVEGACIÓN — Sidebar overlay en móvil
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  /* Overlay de fondo cuando sidebar está abierto */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 190;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .sidebar.mobile-open ~ .sidebar-backdrop,
  .sidebar-backdrop.active {
    display: block;
  }

  /* Sidebar ocupa toda la altura en móvil */
  .sidebar {
    bottom: 0;
    z-index: 400;
    width: min(var(--sidebar-w, 280px), 85vw);
  }

  /* Cerrar sidebar al tocar ítem de nav */
  .nav-item,
  .nav-section-header {
    min-height: 48px;
  }
}

/* --------------------------------------------------------------------------
   5. BOTONES Y FORMULARIOS — Touch targets mínimos 44px
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  .btn {
    min-height: 40px;
    padding: 9px 18px;
  }
}

@media (max-width: 767px) {
  .btn {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 16px;
    border-radius: 10px;
  }

  .btn.secondary {
    min-height: 40px;
  }

  /* Inputs táctiles */
  .field > input,
  .field > select,
  .field > textarea {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
  }

  .field > span {
    font-size: 10px;
    margin-bottom: 4px;
  }

  /* Filter bar: dos columnas en móvil */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-bar .field {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }

  /* Grupos de botones de acción: full width */
  .filter-bar-actions,
  .panel-head .filter-bar .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 479px) {
  .filter-bar .field {
    flex: 1 1 100%;
  }
}

/* --------------------------------------------------------------------------
   6. MÓDULO KPI — Dashboard de Desempeño
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  /* KPI grid: 2 cols en tablet */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Ajuste charts */
  .chart-container {
    height: 200px;
  }

  /* Ocupación: scroll horizontal en tabla */
  #kpiOcupacionPanel .tbl-occ-kpi-wrap,
  #tblKpiOcupacion {
    overflow-x: auto;
  }
}

@media (max-width: 767px) {
  /* KPI grid: 1 col */
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 12px 14px;
    border-radius: 14px;
  }

  .kpi-value {
    font-size: clamp(22px, 7vw, 30px);
  }

  .kpi-split {
    flex-wrap: wrap;
    gap: 8px;
  }

  .kpi-sub {
    min-width: 60px;
  }

  /* Charts móvil */
  .chart-container {
    height: 160px !important;
  }

  /* Panel distribución por estado: apilado */
  #section-kpi .chart-container[style*="display:flex"],
  #section-kpi .chart-container {
    flex-direction: column !important;
    height: auto !important;
  }

  /* Leyenda estado: horizontal scrollable */
  #kpiStateLegend {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 6px !important;
    margin-top: 8px;
  }

  /* Gráfico backlog atrasadas: leyenda apilada arriba */
  #backlogAtrasadasLegend {
    justify-content: center;
    margin-bottom: 8px;
  }

  #backlogAtrasadasLegend > div {
    padding: 6px 12px;
  }

  #backlogAtrasadasLegend span:nth-child(2) {
    font-size: 22px !important;
  }

  /* Backlog atrasadas chart: altura reducida */
  #backlogAtrasadasChart {
    max-height: 180px;
  }

  /* Ocupación panel: scroll área selector tabs */
  #occAreaSelector {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .occ-area-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  /* Tabla ocupación */
  #kpiOcupacionPanel {
    overflow: hidden;
  }

  #kpiOcupacionPanel > div[style*="overflow-x"] {
    -webkit-overflow-scrolling: touch;
  }

  .tbl-occ-kpi {
    font-size: 10px;
    min-width: 600px;
  }

  .tbl-occ-kpi th,
  .tbl-occ-kpi td {
    padding: 5px 6px;
    white-space: nowrap;
  }

  /* Occ legend */
  .occ-legend {
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 10px;
  }

  /* Gráfico ocupación: altura reducida */
  #occChart {
    max-height: 200px;
  }
}

@media (max-width: 479px) {
  .kpi-card {
    padding: 10px 12px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .chart-container {
    height: 140px !important;
  }
}

/* --------------------------------------------------------------------------
   7. MÓDULO GANTT PSM — Carta Gantt
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  /* Secciones de controles: apilar */
  #section-gantt .filter-bar,
  #section-gantt [style*="display: flex"][style*="flex-wrap"] {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Contenedor gantt: scroll táctil */
  .gantt-container {
    -webkit-overflow-scrolling: touch;
    overflow: auto;
  }

  .gantt-day-totals {
    font-size: 8px;
  }
}

@media (max-width: 767px) {
  /* Grupos de controles: apilar en columna */
  #section-gantt > .panel > div > div[style*="display: flex"] {
    flex-direction: column;
    gap: 10px;
  }

  #section-gantt > .panel > div > div[style*="display: flex"] > div {
    width: 100%;
    min-width: 0;
    border-radius: 10px !important;
  }

  /* Gantt sidebar más angosta */
  .gantt-wrapper {
    grid-template-columns: 110px 1fr !important;
  }

  .gantt-sidebar {
    min-width: 110px !important;
  }

  .gantt-row-label {
    height: 58px !important;
    padding: 4px 6px !important;
  }

  .gantt-row-label .op-main-desc {
    font-size: 10px !important;
  }

  .gantt-row-label .op-order-desc,
  .gantt-row-label .op-meta-line {
    font-size: 9px !important;
  }

  .gantt-header,
  .gantt-timeline {
    grid-template-columns: repeat(7, minmax(56px, 1fr));
    height: 58px;
  }

  .gantt-day-header {
    padding: 2px 2px;
    gap: 1px;
  }

  .gantt-day-header strong {
    font-size: 9px;
  }

  .gantt-day-header span {
    font-size: 8px;
  }

  .gantt-day-totals {
    font-size: 7px;
    padding: 1px 2px;
  }

  /* Barra plan/prog/rep: más compactas */
  .gantt-bar {
    font-size: 9px;
    min-height: 16px;
    padding: 0 3px;
    border-radius: 3px;
  }

  /* Botón emergente: full width */
  #btnNewEmergencyOrder {
    width: 100%;
    justify-content: center;
  }

  /* Sección informe diario: apilar */
  #section-gantt [style*="display: flex; gap: 10px; align-items: flex-end"] {
    flex-direction: column;
    align-items: stretch !important;
  }

  #section-gantt [style*="display: flex; gap: 10px; align-items: flex-end"] label,
  #section-gantt [style*="display: flex; gap: 10px; align-items: flex-end"] button {
    width: 100%;
  }
}

@media (max-width: 479px) {
  .gantt-wrapper {
    grid-template-columns: 90px 1fr !important;
  }

  .gantt-sidebar {
    min-width: 90px !important;
  }

  .gantt-header,
  .gantt-timeline {
    grid-template-columns: repeat(7, minmax(44px, 1fr));
  }
}

/* --------------------------------------------------------------------------
   8. MÓDULO BACKLOG — Gestión de Backlog
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  /* Tabla principal backlog: scroll */
  #section-backlog .panel > div[style*="overflow-x"] {
    -webkit-overflow-scrolling: touch;
  }

  /* Panel Gantt backlog: controles apilados */
  #blGanttPanel > div:first-child {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 767px) {
  /* Controles filtro backlog: columna */
  #section-backlog .panel-head,
  #section-backlog [style*="display:flex; justify-content:space-between"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Filtros global backlog */
  #section-backlog .filter-bar {
    width: 100%;
  }

  /* Tabla principal: compacta + scroll */
  #tblBacklogBody tr td {
    font-size: 10px !important;
    padding: 4px 4px !important;
    white-space: nowrap;
  }

  /* ---- Gantt Backlog canvas ---- */
  #blGanttPanel {
    padding: 10px;
    border-radius: 14px;
  }

  /* Barra de controles del Gantt backlog */
  #blGanttPanel > div:first-child {
    flex-direction: column;
    gap: 8px;
  }

  #blGanttPanel > div:first-child label,
  #blGanttPanel > div:first-child select,
  #blGanttPanel > div:first-child input[type="date"],
  #blGanttPanel > div:first-child input[type="number"] {
    width: 100%;
    max-width: 100% !important;
  }

  #blGanttPanel > div:first-child .btn {
    flex: 1;
    justify-content: center;
  }

  /* Grid Gantt backlog: scroll horizontal */
  #blGanttGrid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Header y body del Gantt backlog */
  #blGanttHeaderRow,
  #blGanttBodyRow {
    min-width: 700px;
  }

  /* Columna fecha: más angosta en móvil */
  #blGanttDateColHeader,
  #blGanttDateColumn {
    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;
  }

  #blGanttDateColumn input[type="date"] {
    font-size: 8px !important;
    padding: 1px 2px !important;
  }

  /* Altura máxima body reducida en móvil */
  #blGanttBodyRow {
    max-height: 360px !important;
  }

  /* Popup fecha Gantt: ajuste posición */
  #blGanttDatePopup {
    left: 50% !important;
    transform: translateX(-50%);
    min-width: 90vw !important;
    max-width: 95vw !important;
  }
}

@media (max-width: 479px) {
  #blGanttHeaderRow,
  #blGanttBodyRow {
    min-width: 600px;
  }

  #blGanttDateColHeader,
  #blGanttDateColumn {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
  }
}

/* --------------------------------------------------------------------------
   9. MÓDULO PLANIFICACIÓN — Planning Local
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  .planning-tables-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #planningGanttChart .gantt-wrapper {
    grid-template-columns: 200px 1fr;
  }
}

@media (max-width: 767px) {
  /* Controles filtro planning */
  #section-planning .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  #section-planning .filter-bar .field {
    flex: 1 1 calc(50% - 4px);
  }

  /* Gantt planning */
  #planningGanttChart .gantt-wrapper {
    grid-template-columns: 25% 1fr !important;
  }

  #planningGanttChart .gantt-sidebar {
    min-width: 25%;
  }

  /* Tabla importada */
  #planningOperationsTable {
    min-width: 600px;
    font-size: 10px;
  }

  /* Botones de importación */
  #section-planning .btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 4px;
  }
}

/* --------------------------------------------------------------------------
   10. MÓDULO ÓRDENES — Lista de Órdenes
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  /* Filtros */
  #section-orders-list .filter-bar {
    flex-direction: column;
    gap: 8px;
  }

  #section-orders-list .filter-bar .field {
    flex: 1 1 100%;
  }

  /* Tabla de órdenes */
  #section-orders-list .table-wrap,
  #section-orders-list [style*="overflow-x"] {
    -webkit-overflow-scrolling: touch;
  }
}

/* --------------------------------------------------------------------------
   11. MÓDULO PROYECTOS — Control de Proyectos
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  #section-proyectos .grid-2,
  #section-proyectos-v2 .grid-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 767px) {
  /* Cabecera proyecto */
  #section-proyectos .panel-head,
  #section-proyectos-v2 .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Gantt proyectos V2 */
  #v2GanttContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Timeline P6: scroll horizontal */
  #p6PlannerContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Controles de proyecto */
  #section-proyectos .filter-bar,
  #section-proyectos-v2 .filter-bar {
    flex-wrap: wrap;
  }
}

/* --------------------------------------------------------------------------
   12. MÓDULO ASISTENCIA — Control de Asistencia
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  #section-asistencia .grid-2 {
    grid-template-columns: 1fr;
  }

  #section-asistencia .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  #section-asistencia .kpi-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Tabs de sección */
  #section-asistencia .occ-tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .occ-tab {
    white-space: nowrap;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12px;
  }

  /* Tabla trabajadores */
  #section-asistencia .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  #section-asistencia table {
    min-width: 480px;
    font-size: 11px;
  }

  /* Configuración del worker */
  #section-asistencia [style*="max-width: 700px"] {
    max-width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   13. MÓDULO ADMIN — Panel de Administración
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  #section-admin .grid-2,
  #section-admin [style*="display: grid"] {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 767px) {
  /* Header admin */
  #section-admin .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Botones de acciones admin */
  #adminSuperUserActions {
    flex-wrap: wrap;
    gap: 8px;
  }

  #adminSuperUserActions .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }

  /* Tabla usuarios admin */
  #tblAdminUsers {
    min-width: 560px;
    font-size: 11px;
  }

  #tblAdminUsers th,
  #tblAdminUsers td {
    padding: 6px 8px;
    white-space: nowrap;
  }

  /* Scroll tabla */
  #adminUserManagement [style*="overflow"] {
    -webkit-overflow-scrolling: touch;
  }

  /* Formulario crear usuario */
  #adminUserCreateModal .form-grid,
  #adminUserCreateModal [style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Botones bases de datos JSON */
  #admin_create_bases {
    font-size: 12px !important;
    min-height: 80px;
  }
}

/* --------------------------------------------------------------------------
   14. MODALES — Mejoras generales
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  .modal-card.modal-wide {
    width: 95vw !important;
    max-width: 95vw !important;
  }
}

@media (max-width: 767px) {
  /* Todos los modales: casi pantalla completa */
  .modal-card,
  .modal-card.modal-wide {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 96dvh !important;
    border-radius: 16px 16px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    transform: none !important;
    margin: 0 !important;
  }

  .modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  /* Header modal compacto */
  .modal-head {
    padding: 12px 16px;
    min-height: 48px;
  }

  .modal-title {
    font-size: 15px;
  }

  /* Body scrollable */
  .modal-body {
    padding: 12px 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Tabs del modal: scroll horizontal */
  .modal-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .tab-btn {
    white-space: nowrap;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 11px;
  }

  /* Grids de formulario dentro de modal: 1 columna */
  .modal-body .form-grid,
  .modal-body .hh-grid,
  .modal-body .grid-2 {
    grid-template-columns: 1fr !important;
  }

  /* Tabla operaciones dentro de modal */
  .modal-body .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .modal-body .table {
    min-width: 480px;
    font-size: 11px;
  }

  /* Footer modal: botones full width */
  .modal-foot {
    padding: 10px 14px;
    padding-bottom: calc(10px + var(--safe-area-bottom));
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-foot .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }

  /* Auth modal: no bottom sheet */
  #authModal .modal-card {
    border-radius: 20px !important;
    bottom: auto !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 94vw !important;
    max-height: 92dvh !important;
  }
}

@media (max-width: 479px) {
  .modal-card {
    max-height: 98dvh !important;
  }

  .tab-btn {
    padding: 8px 10px;
    font-size: 10px;
  }
}

/* --------------------------------------------------------------------------
   15. TABLAS — Mejoras de scroll y legibilidad
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  /* Todas las tablas con wrapper: scroll táctil */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  /* Primera columna sticky en tablas importantes */
  .table-compact.sticky-col td:first-child,
  .table-compact.sticky-col th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--panel-inner);
  }
}

@media (max-width: 767px) {
  /* Tabla backlog principal */
  #tblBacklogBody td {
    font-size: 10px !important;
    padding: 5px 4px !important;
    white-space: nowrap;
  }

  /* Tabla de ocupación por rol */
  .table-asistencia {
    min-width: 500px;
    font-size: 10px;
  }

  .table-asistencia th,
  .table-asistencia td {
    padding: 5px 6px;
  }

  /* Badges en tabla */
  .badge {
    font-size: 9px;
    padding: 2px 6px;
  }
}

/* --------------------------------------------------------------------------
   16. GRÁFICOS — Alturas adaptativas
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  /* Ajuste canvas gráficos */
  #kpiStateChart {
    max-height: 180px;
  }

  #usageChart,
  #backlogChart,
  #backlogAtrasadasChart,
  #curveChart,
  #occChart {
    max-height: 200px;
  }
}

@media (max-width: 767px) {
  #kpiStateChart {
    max-height: 150px;
  }

  #usageChart,
  #backlogChart,
  #backlogAtrasadasChart {
    max-height: 160px;
  }

  #curveChart {
    max-height: 180px;
  }

  #occChart {
    max-height: 170px;
  }

  /* Distribución estado: reorganizar layout */
  #section-kpi .panel.inner .chart-container {
    flex-direction: column !important;
    align-items: stretch;
    height: auto !important;
    gap: 12px;
  }

  #section-kpi .panel.inner .chart-container > div:first-child {
    height: 150px !important;
    flex: none !important;
  }
}

/* --------------------------------------------------------------------------
   17. BIENVENIDA Y LANDING — Pantallas iniciales
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .welcome-card {
    padding: 32px 20px;
    border-radius: 20px;
    margin: 16px;
  }

  .welcome-logo {
    width: 56px;
    height: 56px;
    font-size: 22px;
    border-radius: 14px;
  }

  .welcome-card h1 {
    font-size: clamp(20px, 6vw, 28px);
  }

  .welcome-card p {
    font-size: 13px;
  }

  .btn-start {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    justify-content: center;
  }

  /* Landing page */
  .lp-page .lp-hero {
    padding: 40px 20px;
  }

  .lp-page .lp-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* --------------------------------------------------------------------------
   18. MAPA — Leaflet map
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  #section-map .panel {
    padding: 0;
    overflow: hidden;
  }

  #section-map .inner-head {
    padding: 12px;
  }

  /* Mapa: altura reducida en móvil */
  #mapContainer,
  .leaflet-container {
    height: 60vh !important;
    min-height: 280px;
    border-radius: 0 0 12px 12px;
  }
}

/* --------------------------------------------------------------------------
   19. UTILIDADES RESPONSIVE
   -------------------------------------------------------------------------- */

/* Ocultar en móvil */
@media (max-width: 767px) {
  .hidden-mobile { display: none !important; }
}

/* Ocultar en tablet */
@media (max-width: 1023px) {
  .hidden-tablet { display: none !important; }
}

/* Solo visible en móvil */
.show-mobile { display: none; }
@media (max-width: 767px) {
  .show-mobile { display: block; }
}

/* Texto truncado en móvil */
@media (max-width: 767px) {
  .truncate-mobile {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
}

/* Safe area bottom (iPhone notch) */
@media (max-width: 767px) {
  .mobile-bottom-nav {
    padding-bottom: var(--safe-area-bottom);
  }
}

/* Scrollbar fino en contenedores táctiles */
@media (max-width: 1023px) {
  .gantt-container::-webkit-scrollbar,
  .modal-body::-webkit-scrollbar,
  #blGanttGrid::-webkit-scrollbar,
  .table-wrap::-webkit-scrollbar {
    height: 4px;
    width: 4px;
  }

  .gantt-container::-webkit-scrollbar-track,
  .modal-body::-webkit-scrollbar-track {
    background: transparent;
  }

  .gantt-container::-webkit-scrollbar-thumb,
  .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
  }
}
