/* ── Responsive ── */

/* Tablet */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .topbar {
    padding: 0 var(--space-md);
  }

  .page-content {
    padding: var(--space-md);
  }

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

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .table-toolbar-left,
  .table-toolbar-right {
    flex-wrap: wrap;
  }

  /* Chat: conversation list becomes drawer */
  .chat-sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  .notification-dropdown {
    width: calc(100vw - 32px);
    right: -60px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .input,
  .filter-bar .select {
    width: 100%;
    min-width: 0;
  }

  .report-filters {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .modal {
    max-width: 100%;
    margin: var(--space-md);
  }
}

/* ── Table horizontal scroll ── */
@media (max-width: 700px) {
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
  }
}
