/* Base compartida: evita desbordamientos sin alterar la estructura de cada vista. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

input, select, textarea, button {
  max-width: 100%;
  font: inherit;
}

input, select, textarea {
  min-width: 0;
}

button, .btn {
  touch-action: manipulation;
}

table {
  max-width: 100%;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.btn, button, input[type="submit"], input[type="button"] {
  min-height: 42px;
  white-space: normal;
  text-align: center;
}

@media (max-width: 1024px) {
  .container, main.container {
    width: min(100%, 920px);
    margin-left: auto;
    margin-right: auto;
  }

  .wrapper {
    width: min(100%, 960px) !important;
  }

  .chart {
    overflow-x: auto;
    justify-content: flex-start !important;
    padding-bottom: 12px;
  }

  .container {
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  body {
    min-height: 100svh;
  }

  .container, main.container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 20px !important;
    border-radius: 0 !important;
  }

  .layout {
    width: 100% !important;
  }

  .contenido {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 72px 16px 20px !important;
  }

  .menu {
    width: min(82vw, 300px) !important;
    box-shadow: 18px 0 36px rgba(15, 23, 42, 0.25);
  }

  .hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .card {
    border-radius: 12px !important;
  }

  .navbar, .header, .flex-between, .card-footer, .acciones-top, .info {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .actions, .pagination {
    flex-wrap: wrap;
    width: 100%;
  }

  .navbar h1, .header h1, h1, h2 {
    overflow-wrap: anywhere;
    text-align: center;
  }

  .breadcrumb {
    text-align: center;
  }

  .form-grid, .row {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }

  .form-group, .form-grid > *, .row > * {
    width: 100% !important;
  }

  input, select, textarea, .input, .form-input, .form-textarea {
    width: 100% !important;
    min-height: 44px;
  }

  .btn, button, .card-footer .btn, .footer a {
    width: 100%;
    justify-content: center;
  }

  .actions .btn,
  .pagination .btn {
    flex: 1 1 180px;
  }

  td .btn,
  .table-wrapper .btn {
    width: auto;
    min-width: 86px;
    margin: 2px;
  }

  .logos, .imagenes-encabezado {
    justify-content: center !important;
    flex-wrap: wrap;
  }

  .logos img, .imagenes-encabezado img {
    width: 58px !important;
    height: 58px !important;
    object-fit: contain !important;
  }

  .left-panel {
    min-height: 180px !important;
  }

  .right-panel {
    padding: 28px 20px !important;
  }

  .chart {
    min-height: 0 !important;
    height: auto !important;
    align-items: end !important;
    gap: 18px !important;
  }

  .bar-box {
    min-width: 112px;
  }

  .bar {
    max-height: 260px;
  }

  .footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .result-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .table-wrapper {
    margin-inline: -1px;
    border-radius: 8px;
  }

  .table-wrapper table {
    min-width: 640px;
  }

  .header-text {
    text-align: center !important;
  }

  .header img {
    width: 56px !important;
    height: 56px !important;
  }

  .estado {
    flex-direction: column !important;
    align-items: stretch !important;
    margin-inline: 16px !important;
  }

  .estado-right {
    text-align: left !important;
  }
}

@media (max-width: 480px) {
  body {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .container, main.container, .card-body, .card-header, .card-footer {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  h1 { font-size: clamp(1.35rem, 7vw, 1.75rem); }
  h2 { font-size: clamp(1.15rem, 6vw, 1.45rem); }

  .card, .login-card {
    padding: 20px !important;
    border-radius: 12px !important;
  }

  .logos {
    gap: 10px;
  }

  .logos img {
    height: 46px !important;
    width: auto !important;
    object-fit: contain;
  }

  .btn-back {
    top: 12px !important;
    left: 12px !important;
    width: 40px !important;
    height: 40px !important;
  }

  .wrapper {
    border-radius: 0 !important;
  }

  .dropzone {
    padding: 20px 14px !important;
  }

  table {
    min-width: 640px;
  }
}
