/* ============================================================
   Responsive — pantallas <= 720px (tablet/mobile)
   ============================================================ */
/* ============================================================
   Hamburger button (oculto en desktop)
   ============================================================ */
.btn-menu {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-menu span {
  display: block;
  width: 24px;
  height: 3px;
  background: #000;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

body.menu-open .btn-menu span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

body.menu-open .btn-menu span:nth-child(2) {
  opacity: 0;
}

body.menu-open .btn-menu span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

@media (max-width: 768px) {
  body {
    font-size: 13px;
  }

  /* Mostrar botón hamburger */
  .btn-menu {
    display: flex;
  }

  /* Por defecto en mobile, tabs y status quedan ocultos. Aparecen como
     drawer desde la derecha cuando body tiene .menu-open */
  .tabs,
  .status {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80vw;
    height: 100vh;
    background: var(--bg);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
    z-index: 100;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 70px 0 16px;
    overflow-y: auto;
  }

  .tabs {
    padding-top: 70px;
  }

  .status {
    top: auto;
    bottom: 0;
    height: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    box-shadow: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 14px;
    transform: none;
    width: 280px;
    max-width: 80vw;
    z-index: 101;
  }

  .status {
    transform: translateX(100%);
  }

  body.menu-open .tabs,
  body.menu-open .status {
    transform: translateX(0);
  }

  body.menu-open {
    overflow: hidden;
  }

  .content {
    padding: 16px;
    overflow-x: hidden;
  }

  .cards {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .cards > .card {
    flex: 0 0 calc(50% - 5px) !important;
    width: calc(50% - 5px) !important;
    max-width: calc(50% - 5px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 14px;
  }

  .card-value {
    font-size: 20px;
  }

  .block {
    padding: 14px;
  }

  /* Forms en columna — forzar 1 columna y anular span-N inline */
  .form-row {
    grid-template-columns: 1fr !important;
    max-width: 100%;
  }

  .form-row > * {
    grid-column: 1 / -1 !important;
    max-width: 100%;
    min-width: 0;
  }

  .form-field input,
  .form-field select,
  .form-field textarea {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Filtros en mobile: stack en columna */
  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .filters label {
    display: none; /* Ahorra espacio; los controles son autoexplicativos */
  }

  .filters select,
  .filters input {
    width: 100%;
  }

  /* Ocultar perfil-info y dropdown "Cerrar sesión" del header en mobile */
  .profile-info,
  .profile-dropdown {
    display: none;
  }

  .header {
    padding: 0 12px;
    gap: 10px;
  }

  .header-title {
    font-size: 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    gap: 10px;
  }

  .btn-row {
    flex-direction: column-reverse;
  }

  .btn-row-quick {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  /* Modal full-width */
  .modal-overlay {
    padding: 0;
    align-items: flex-start;
  }

  .modal {
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
  }
}

@media (max-width: 480px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    padding: 24px;
    border-radius: 8px;
  }

  .welcome-card h1 {
    font-size: 26px;
  }

  /* Header compacto en móvil: ocultamos texto del perfil, dejamos solo el avatar */
  .profile-info,
  .profile-dropdown {
    display: none;
  }

  .header-title {
    flex: 1;
    font-size: 18px;
  }

  .header {
    padding: 0 12px;
  }
}

