/* Distribuidora Montoya en el móvil (app instalable).
   En el ordenador no cambia nada: casi todo va dentro de @media para pantallas estrechas. */

/* ---------- firma de Kodiga (discreta) ---------- */
.firma-kodiga { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #6c757d; text-decoration: none; padding: 8px 4px; }
.firma-kodiga img { width: 16px; height: 16px; }
.firma-kodiga strong { color: #2b2940; font-weight: 700; letter-spacing: -.01em; }
.firma-kodiga:hover strong { text-decoration: underline; }
.pie-kodiga { justify-content: center; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid #e3e6ea; }

/* ---------- barra inferior (teléfonos) ---------- */
.nav-movil {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid #dee2e6;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .06);
}
.nav-movil a, .nav-movil button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 62px; border: 0; background: none; padding: 0;
  color: #6c757d; text-decoration: none; font-size: 12px; font-weight: 600;
}
.nav-movil i { font-size: 1.35rem; line-height: 1; }
.nav-movil .activo { color: var(--montoya-azul); }
.nav-movil .activo i { color: var(--montoya-rojo); }

/* ---------- panel "Más" ---------- */
.panel-mas.offcanvas-bottom { height: auto; max-height: 85vh; border-radius: 18px 18px 0 0; }
.panel-mas .offcanvas-body { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.panel-mas .grupo { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6c757d; margin: 4px 0 10px; }
.panel-mas .rejilla { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.panel-mas .rejilla a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 84px; padding: 10px 6px; border: 1px solid #e3e6ea; border-radius: 12px; background: #fff;
  color: #212529; text-decoration: none; font-size: 13px; font-weight: 600; line-height: 1.2;
}
.panel-mas .rejilla a i { font-size: 1.4rem; color: var(--montoya-azul); }
.panel-mas .rejilla a:active { background: #f1f3f5; }

@media (max-width: 767.98px) {
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .navbar { margin-bottom: 1rem !important; position: sticky; top: 0; z-index: 1020; padding-top: calc(.5rem + env(safe-area-inset-top, 0px)) !important; }
  .navbar-brand { font-size: 1.1rem; margin-right: 0; }
  .navbar-brand::before { content: none; } /* el emoji del ordenador se ve distinto en cada Android */
  .container-fluid { padding-left: 12px; padding-right: 12px; }
  h1, .h1 { font-size: 1.5rem; }
  h2, .h2 { font-size: 1.25rem; }

  /* cabeceras de pantalla con botones: se apilan en vez de desbordarse */
  .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }
  .btn-group { flex-wrap: wrap; }
}

/* ---------- tamaños de dedo y formularios (teléfonos y tabletas) ---------- */
@media (max-width: 991.98px) {
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .btn-sm { min-height: 40px; }
  .form-control, .form-select, input, select, textarea { font-size: 16px !important; } /* el iPhone no amplía la pantalla */
  .form-control, .form-select { min-height: 44px; }
  .form-check-input { width: 1.3em; height: 1.3em; }
  .dropdown-item { padding-top: .6rem; padding-bottom: .6rem; }
}

/* ---------- tablas: en el teléfono cada fila es una tarjeta ---------- */
@media (max-width: 575.98px) {
  .table-responsive { overflow-x: visible; }
  table.tabla-movil { border: 0; }
  table.tabla-movil thead { display: none; }
  table.tabla-movil, table.tabla-movil tbody, table.tabla-movil tfoot, table.tabla-movil tr, table.tabla-movil td, table.tabla-movil th { display: block; width: 100%; }
  table.tabla-movil tr {
    background: #fff; border: 1px solid #e3e6ea; border-radius: 12px; margin-bottom: 10px;
    padding: 6px 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  }
  table.tabla-movil > :not(caption) > * > * { border-bottom-width: 0; background: transparent; box-shadow: none; }
  table.tabla-movil td, table.tabla-movil tfoot th {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 7px 0 !important; border-top: 1px solid #f1f3f5; text-align: right; min-height: 40px; word-break: break-word;
  }
  table.tabla-movil td:first-child, table.tabla-movil tfoot th:first-child { border-top: 0; }
  table.tabla-movil td::before {
    content: attr(data-label); flex: 0 0 auto; max-width: 48%;
    color: #6c757d; font-size: 13px; font-weight: 600; text-align: left;
  }
  table.tabla-movil td:not([data-label])::before, table.tabla-movil td[data-label=""]::before { content: none; }
  table.tabla-movil td:not([data-label]), table.tabla-movil td[data-label=""] { justify-content: flex-end; }
  /* primera celda: el "título" de la tarjeta */
  table.tabla-movil td.td-titulo { font-weight: 700; font-size: 16px; justify-content: flex-start; text-align: left; }
  table.tabla-movil td.td-titulo::before { content: none; }
  /* celdas con botones: los botones a lo ancho */
  table.tabla-movil td.td-acciones { justify-content: flex-end; flex-wrap: wrap; }
  table.tabla-movil td.td-acciones::before { content: none; }
  table.tabla-movil td.td-acciones .btn { flex: 1 1 auto; }
  table.tabla-movil tr.table-active, table.tabla-movil tfoot tr { background: #f8f9fa; }

  /* tablas que no tienen sentido como tarjetas (matrices de reportes): scroll lateral con la 1.ª columna fija */
  .tabla-no-movil-envoltura { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tabla-no-movil th:first-child, table.tabla-no-movil td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .offcanvas { transition: none !important; }
}
