@media (max-width: 980px) {
  body { background: #f6f7f9; }

  .app-body { padding: 0 0 24px; }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    border-radius: 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.98);
    align-items: center;
  }

  .app-header.has-tabs {
    gap: 8px;
  }

  .app-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .app-header-search {
    width: 100%;
    justify-content: stretch;
  }

  .app-header-search-input { max-width: none; }

  .app-header::before { opacity: 0.2; }

  .app-header h1 { font-size: 18px; }

  .app-nav { width: auto; margin-left: auto; overflow: visible; padding-bottom: 0; flex-wrap: nowrap; align-self: flex-end; }

  .app-header-tabs { width: 100%; }

  .top-tabs {
    position: static;
    z-index: 30;
    background: transparent;
    border-radius: 0;
    padding: 4px 0 0;
    box-shadow: none;
  }

  .top-tabs-left {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    scroll-snap-type: x mandatory;
    padding-bottom: 2px;
  }
  .top-tabs .tab-button {
    flex: 0 0 auto;
    min-width: 58px;
    padding: 10px 8px;
    scroll-snap-align: center;
  }
  .top-tabs .tab-icon {
    width: 20px;
    height: 20px;
  }
  .top-tabs .tab-icon svg {
    width: 20px;
    height: 20px;
  }
  .top-tabs .tab-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .controls-panel[data-collapsed="true"] {
    display: none;
  }

  #pipeline-actions {
    justify-content: space-between;
  }
  #pipeline-actions .control-group label {
    display: none;
  }

  .metrics-bar {
    display: block;
  }

  #metrics-bar .metrics-inner {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
  }

  #metrics-bar .metrics-item { scroll-snap-align: start; min-width: 150px; }
  #metrics-bar .metrics-more-row {
    justify-content: flex-start;
  }
  #metrics-bar .metrics-more-drawer {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    overflow-x: hidden;
    padding-bottom: 8px;
  }

  .kanban-column { scroll-snap-align: start; }

  .pipeline-stage-tabs {
    display: flex;
    width: 100%;
    justify-content: space-between;
  }

  .pipeline-stage-tab {
    flex: 1;
    justify-content: center;
  }

  .kanban-board[data-stage-view="todo"] .kanban-column[data-stage="doing"],
  .kanban-board[data-stage-view="todo"] .kanban-column[data-stage="done"],
  .kanban-board[data-stage-view="doing"] .kanban-column[data-stage="todo"],
  .kanban-board[data-stage-view="doing"] .kanban-column[data-stage="done"],
  .kanban-board[data-stage-view="done"] .kanban-column[data-stage="todo"],
  .kanban-board[data-stage-view="done"] .kanban-column[data-stage="doing"] {
    display: none;
  }

  .work-view,
  .calendar-view,
  .marketplace-view,
  .files-view { margin-top: 10px; }

  .dashboard-main,
  .deal-main {
    margin-top: 0;
    padding: 14px 14px 28px;
  }

  .deal-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
  }

  .deal-tab {
    flex: 0 0 auto;
  }

  .work-subtabs,
  .work-top { flex-direction: column; align-items: flex-start; }

  .work-subtabs-right { width: 100%; }
  .work-subtabs-left { width: 100%; overflow-x: auto; }

  .calendar-ai-scheduler { border-radius: 16px; }

  .contacts-layout { grid-template-columns: 1fr; }
  .contacts-summary { overflow-x: auto; }
  .contacts-summary-card { min-width: 140px; }
  .contacts-panel-side { order: 2; }
  .contacts-segments { overflow-x: auto; }
  .contacts-subtabs { overflow-x: auto; }
  .contacts-subtab { white-space: nowrap; }
  .contacts-market-grid,
  .contacts-market-grid-split { grid-template-columns: 1fr; }
  .contacts-chat-input { flex-direction: column; align-items: stretch; }
  .contacts-chat-input .primary-button { width: 100%; }
  .contacts-focus-stats { grid-template-columns: 1fr; }
  .contacts-focus-actions { flex-direction: column; align-items: stretch; }
  .contacts-focus-deal { flex-direction: column; align-items: flex-start; }
  .contacts-focus-deal .stage-button { width: 100%; }

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

  .files-shell { grid-template-columns: 1fr; }
  .files-upload-actions { width: 100%; }
  .files-upload-actions button { flex: 1; }

  .modal-content {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }

  .modal,
  .notes-modal {
    align-items: flex-start;
    padding: 0;
    background: #f6f7f9;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    background: rgba(246, 247, 249, 0.98);
    padding: 12px 12px calc(6px + env(safe-area-inset-bottom));
  }

  #deal-modal #deal-modal-files {
    margin-right: 0 !important;
  }

  #deal-modal .modal-actions button {
    flex: 1 1 140px;
  }

  .modal-title,
  .modal-deal-name { font-size: 18px; }

  .ai-panel {
    right: 12px;
    left: 12px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: auto;
  }

  .ai-fab {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .app-menu-panel {
    width: min(360px, 90vw);
  }
}
