/* Ordered largest-to-smallest so narrower breakpoints override wider ones */

/* ── Tablet & below (max-width: 900px) ── */
@media (max-width: 900px) {
  #board-view.active {
    overflow-y: auto;
    flex-direction: column;
  }

  .board-columns {
    flex-wrap: wrap;
  }

  .board-column {
    max-width: none;
  }

  .chat-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
    max-height: 40vh;
  }

  #chat-panel {
    display: none;
  }

  header h1 { font-size: 15px; }
  .tab-btn { padding: 6px 12px; font-size: 13px; }
  #filter-bar { padding: 8px 12px; }
  #filter-bar select, #filter-bar input { font-size: 12px; padding: 6px 8px; }
}

/* ── Mobile (max-width: 768px) ── */
@media (max-width: 768px) {
  #mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    padding: 6px 14px;
    margin: 8px 12px 0;
    flex-shrink: 0;
  }

  #filter-bar {
    display: none;
  }

  #filter-bar.open {
    display: flex;
    flex-wrap: wrap;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px var(--shadow);
    max-height: 50vh;
    overflow-y: auto;
    padding: 12px 16px;
  }

  #board-view.active {
    overflow-y: auto;
  }

  .board-columns {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 12px;
    flex: none;
  }

  .board-column {
    flex: none;
    max-width: none;
    min-width: 0;
    max-height: none;
    height: auto;
  }

  .chat-panel {
    display: none;
  }

  .board-card {
    cursor: pointer;
  }

  .board-card:hover {
    box-shadow: none;
    border-color: var(--border);
  }

  .board-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-bg);
  }

  .card-edit-btn {
    display: inline-flex;
  }

  #mobile-chat-overlay .chat-header-title {
    max-width: 200px;
  }
}

/* ── Small phones (max-width: 600px) ── */
@media (max-width: 600px) {
  header {
    padding: 0 12px;
    flex-wrap: wrap;
    height: auto;
    min-height: 52px;
    gap: 4px;
  }

  .header-center {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .modal {
    margin: 20px 10px;
  }

  .form-row {
    flex-direction: column;
    gap: 14px;
  }
}
