/* Breakpoint: tablet and below (≤ 900px) */
@media (max-width: 900px) {
  body, .app {
    height: auto !important;
    overflow: visible !important;
  }

  .app {
    padding: var(--space-3);
  }

  .main {
    grid-template-columns: 1fr !important;
    height: auto !important;
    overflow: visible !important;
  }

  .sidebar {
    border-radius: var(--r-lg);
    max-height: 56px;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .sidebar.open {
    max-height: 1500px;
  }

  .sidebar-header,
  .sidebar-footer {
    position: static;
  }

  .sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .sidebar-toggle .arrow {
    transition: transform 0.25s ease;
  }

  .sidebar.open .sidebar-toggle .arrow {
    transform: rotate(180deg);
  }

  .output {
    width: 100%;
    min-height: 60vh;
    height: auto !important;
    overflow-y: visible !important;
  }

  .empty-pipeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .loading-shell {
    grid-template-columns: 1fr;
  }
}

/* Breakpoint: phone (≤ 480px) */
@media (max-width: 480px) {
  header {
    padding: 0 12px !important;
  }
  
  .logo-name {
    display: none !important;
  }

  .header-center {
    display: none !important; /* Hide crumbs on phone viewports for space */
  }

  .header-right {
    gap: 4px !important;
  }

  .header-right .btn-small {
    padding: 6px 8px !important;
    font-size: 10px !important;
  }

  .header-right .status-pill {
    display: none !important;
  }

  .sidebar-section {
    padding: 16px;
  }

  .btn-generate {
    width: 100%;
    padding: 12px;
  }

  .tabs-row {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs-row::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto !important;
    padding: 12px 14px !important;
  }

  .score-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    font-size: 11px !important;
  }

  .score-bar-right {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
    margin-top: 4px !important;
  }

  .verdict-pill {
    width: 100% !important;
    text-align: center !important;
  }

  .loading-3d-viewport {
    min-height: 200px !important;
  }

  .empty-pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-area {
    padding: var(--space-4);
  }

  .blog-title {
    font-size: 20px;
  }

  .review-grid {
    grid-template-columns: 1fr !important;
  }

  .image-grid {
    grid-template-columns: 1fr !important;
  }

  #humanGateBanner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 12px 16px !important;
  }

  #humanGateBanner > div:last-child {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  #humanGateBanner button {
    flex: 1;
    padding: 8px;
  }
}
