/* ========================================
   ALWAIZ DASHBOARD — MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {

  /* ── Hamburger button (injected by mobile.js) ── */
  #mob-menu-btn {
    display: flex !important;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    width: 42px;
    height: 42px;
    background: var(--color-brand, #0a0a0a);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }
  #mob-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  body.mob-open #mob-menu-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.mob-open #mob-menu-btn span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  body.mob-open #mob-menu-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ── Sidebar: hidden off-screen by default ── */
  aside {
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    z-index: 150 !important;
  }
  body.mob-open aside {
    transform: translateX(0) !important;
  }

  /* ── Overlay behind sidebar ── */
  body.mob-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 149;
  }

  /* ── Main content: full width, no sidebar margin ── */
  main {
    margin-left: 0 !important;
    padding-top: 0;
  }

  /* ── Page header: push content right of hamburger button ── */
  main > div:first-child > div:first-child,
  [class*="page-header"],
  main > div > div:first-child {
    padding-left: 64px !important;
  }

  /* ── Content padding: tighter on mobile ── */
  .content,
  main > div > div {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  [class*="p-8"]  { padding: 1rem !important; }
  [class*="px-8"] { padding-left: 1rem !important; padding-right: 1rem !important; }
  [class*="p-10"] { padding: 1.25rem !important; }
  [class*="p-12"] { padding: 1.5rem !important; }

  /* ── Grid layouts: 1 column on mobile ── */
  .grid-cols-2 { grid-template-columns: 1fr !important; }
  .grid-cols-3 { grid-template-columns: 1fr !important; }
  .grid-cols-4 { grid-template-columns: 1fr !important; }

  /* ── Stat/KPI cards row: 2 columns max ── */
  .grid.grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid.grid-cols-3 { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Pipeline Kanban: horizontal scroll ── */
  .overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Charts wrapper ── */
  .recharts-responsive-container,
  [class*="recharts"] {
    min-width: 0 !important;
  }

  /* ── Tables: horizontal scroll ── */
  table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Modals: full screen on mobile ── */
  [style*="width:340"] {
    width: 100vw !important;
  }
  [style*="width: 340"] {
    width: 100vw !important;
  }

  /* ── Forms: stack inputs vertically ── */
  .search-form {
    flex-direction: column;
  }

  /* ── Touch targets: min 44px ── */
  button, a[class*="btn"] {
    min-height: 44px;
  }

  /* ── Typography scale down ── */
  .text-3xl { font-size: 1.5rem !important; }
  .text-2xl { font-size: 1.25rem !important; }
  .text-xl  { font-size: 1.1rem !important; }

  /* ── Overflow hidden fix ── */
  body { overflow-x: hidden; }

  /* ── Buscador iframe full height ── */
  iframe[src*="buscador"] {
    height: 100vh !important;
  }
}

/* ── Extra small ── */
@media (max-width: 480px) {
  .grid.grid-cols-4,
  .grid.grid-cols-3,
  .grid.grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
}

/* ── Hide hamburger on desktop ── */
@media (min-width: 769px) {
  #mob-menu-btn { display: none !important; }
}
