/* =============================================
   Responsive Breakpoints
   Desktop ≥1024px | Tablet 768-1023px | Mobile <768px
   ============================================= */

/* ── Desktop (≥1024px) ── */
@media (min-width: 1024px) {

  #view-dashboard.active {
    display: flex;
    flex-direction: row;
  }

  .dashboard-layout {
    grid-template-columns: 35fr 65fr;
  }

  .agent-grid {
    width: auto;
    max-width: none;
  }

  .detail-panel {
    width: auto;
    max-width: none;
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    border-radius: var(--radius-lg);
    box-shadow: none;
    max-height: none;
  }

  .detail-panel.state-empty {
    min-height: 300px;
  }

  .kanban-board {
    overflow-x: auto;
  }

  .kanban-column {
    min-width: 260px;
    max-width: 280px;
    scroll-snap-align: none;
  }

  .logs-view-wrapper {
    grid-template-columns: 20fr 80fr;
  }

  .log-tree-panel {
    max-height: calc(100vh - var(--topbar-height) - var(--footer-height) - 80px);
  }
}

/* ── Tablet (768-1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {

  .view-container.active {
    flex-direction: column;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    width: 100%;
    max-width: 100%;
  }

  .detail-panel {
    width: 100%;
    max-width: 100%;
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 50;
    border-radius: var(--radius-lg) 0 0 0;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    animation: slide-in-right 250ms var(--ease-out);
    max-height: calc(100vh - var(--topbar-height));
    transform: none;
  }

  .detail-panel.state-empty {
    display: none;
  }

  .detail-back-btn {
    display: flex;
  }

  .kanban-board {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-lg);
  }

  .kanban-column {
    min-width: 240px;
    max-width: 280px;
    scroll-snap-align: start;
  }

  .logs-view-wrapper {
    grid-template-columns: 1fr;
  }

  .log-tree-panel {
    max-height: 200px;
  }

  .activity-feed {
    max-width: 100%;
  }

  #activity-ticker.expanded {
    height: 160px;
  }
}

/* ── Mobile (<768px) ── */
@media (max-width: 767px) {

  #topbar {
    padding: 0 var(--space-sm);
    gap: var(--space-xs);
  }

  .logo {
    font-size: var(--text-base);
  }

  .nav-tab {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
  }

  .settings-btn {
    font-size: var(--text-base);
  }

  .view-container {
    padding: var(--space-sm);
  }

  #view-dashboard.active {
    flex-direction: column;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    width: 100%;
    max-width: 100%;
    gap: var(--space-sm);
    grid-template-columns: repeat(2, 1fr);
  }

  .agent-card {
    width: calc(50% - var(--space-xs));
    min-width: 0;
    min-height: 240px;
    padding: var(--space-sm);
  }

  .agent-card-stats {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .detail-panel {
    width: 100%;
    max-width: 100%;
    position: fixed;
    inset: 0;
    z-index: 50;
    border-radius: 0;
    padding: var(--space-md);
    max-height: 100vh;
    overflow-y: auto;
    animation: fade-in 200ms var(--ease-out);
  }

  .detail-panel.state-empty {
    display: none;
  }

  .detail-back-btn {
    display: flex;
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 2;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    background: var(--overlay-medium);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    gap: var(--space-xs);
  }

  .detail-back-btn:hover {
    background: var(--overlay-heavy);
    color: var(--text-primary);
  }

  .detail-avatar {
    width: 56px;
    height: 56px;
  }

  .detail-avatar .persona-svg {
    width: 56px;
    height: 56px;
  }

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

  .kanban-board {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: var(--space-sm);
    padding-bottom: var(--space-lg);
  }

  .kanban-column {
    min-width: 200px;
    max-width: 260px;
    scroll-snap-align: start;
  }

  .kanban-task-card {
    padding: var(--space-xs) var(--space-sm);
  }

  .kanban-drag-handle {
    display: none;
  }

  .logs-view-wrapper {
    grid-template-columns: 1fr;
  }

  .log-tree-panel {
    max-height: 160px;
  }

  .activity-feed {
    max-width: 100%;
  }

  .activity-filter-chips {
    gap: var(--space-xs);
  }

  .filter-chip {
    padding: var(--space-xs) var(--space-sm);
    font-size: 10px;
  }

  #activity-ticker.collapsed {
    height: 28px;
  }

  #activity-ticker.expanded {
    height: 120px;
  }

  .ticker-content {
    font-size: 10px;
  }

  #footer {
    font-size: 10px;
    gap: var(--space-xs);
  }

  .modal-card {
    max-width: calc(100% - 16px);
    border-radius: var(--radius-lg);
    max-height: calc(100vh - 16px);
  }

  .modal-card-header {
    padding: var(--space-md) var(--space-md) 0;
  }

  .modal-card-body {
    padding: var(--space-sm) var(--space-md);
  }

  .modal-actions {
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }

  .modal-form-card {
    max-width: calc(100% - 16px);
  }

  .modal-chat-card {
    max-width: calc(100% - 16px);
  }

  .chat-messages-body {
    min-height: 150px;
    max-height: 250px;
    padding: var(--space-sm) var(--space-md);
  }

  .chat-input-group {
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }
}
