@media (max-width: 1280px) {
  :root {
    --sidebar-w: 86px;
    --list-w: 326px;
    --details-w: 312px;
  }

  .sidebar {
    padding: 16px 10px;
  }

  .sidebar .brand-lockup {
    justify-content: center;
    padding-inline: 0;
  }

  .sidebar .brand-lockup div,
  .sidebar .panel.flush h2,
  .sidebar .panel.flush select,
  .sidebar .sidebar-footer,
  .sidebar .ghost-button.full,
  .sidebar .nav-label {
    display: none;
  }

  .nav-item {
    justify-content: center;
    min-height: 36px;
    padding: 9px 6px;
    font-size: 10.5px;
  }

  .nav-item::before {
    display: none;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: var(--sidebar-w) minmax(300px, 356px) minmax(420px, 1fr);
  }

  .details-column {
    position: fixed;
    inset: 56px 0 0 auto;
    z-index: 10;
    width: min(380px, 92vw);
    transform: translateX(100%);
    box-shadow: var(--shadow);
    transition: transform 180ms ease;
  }

  .app-shell.details-open .details-column {
    transform: translateX(0);
  }

  .mobile-detail-toggle {
    display: inline-flex;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
  }

  .mobile-left-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-brand img {
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }

  .mobile-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-actions .ghost-button {
    min-height: 32px;
    padding: 6px 9px;
  }

  .dashboard-page .app-shell {
    height: calc(100vh - 56px);
  }
}

@media (min-width: 1181px) {
  .mobile-detail-toggle {
    display: none;
  }
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
    height: calc(100vh - 56px);
  }

  .sidebar,
  .inbox-column,
  .chat-column {
    display: none;
    height: 100%;
    border-right: 0;
  }

  .app-shell.mobile-chat .chat-column {
    display: flex;
  }

  .app-shell.mobile-list {
    display: grid;
    grid-template-columns: 224px 1fr;
  }

  .app-shell.mobile-list .sidebar,
  .app-shell.mobile-list .inbox-column {
    display: flex;
  }

  .app-shell.mobile-list .sidebar {
    display: flex;
  }

  .chat-header h2 {
    max-width: 58vw;
  }

  .message {
    max-width: 76%;
  }

  .mobile-overlay {
    position: fixed;
    inset: 56px 0 0;
    z-index: 9;
    display: none;
    border: 0;
    padding: 0;
    background: rgba(12, 18, 32, 0.28);
  }

  .app-shell.nav-open ~ .mobile-overlay,
  .app-shell.details-open ~ .mobile-overlay {
    display: block;
  }

  .app-shell.nav-open .sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    z-index: 12;
    display: flex;
    box-shadow: var(--shadow);
  }

  .app-shell.nav-open .sidebar {
    left: 0;
    width: min(292px, 86vw);
    border-right: 1px solid var(--border);
  }

  .app-shell.nav-open .inbox-column {
    display: none;
  }

  .app-shell.nav-open .sidebar .brand-lockup {
    justify-content: flex-start;
  }

  .app-shell.nav-open .sidebar .brand-lockup div,
  .app-shell.nav-open .sidebar .panel.flush h2,
  .app-shell.nav-open .sidebar .panel.flush select,
  .app-shell.nav-open .sidebar .sidebar-footer,
  .app-shell.nav-open .sidebar .ghost-button.full,
  .app-shell.nav-open .sidebar .nav-label {
    display: block;
  }

  .app-shell.nav-open .nav-item {
    justify-content: flex-start;
    padding: 8px 10px;
    font-size: 13px;
  }

  .app-shell.nav-open .nav-item::before {
    display: grid;
  }
}

@media (max-width: 680px) {
  .app-shell.mobile-list {
    grid-template-columns: 1fr;
  }

  .app-shell.mobile-list .sidebar {
    display: none;
  }

  .app-shell.nav-open .sidebar {
    display: flex;
    width: min(292px, 88vw);
  }

  .app-shell.nav-open .inbox-column {
    display: none;
  }

  .toolbar {
    padding: 12px;
  }

  .message-list {
    padding: 16px 12px;
  }

  .message {
    max-width: 88%;
  }

  .chat-header {
    min-height: 60px;
    padding: 12px;
  }

  .chat-header h2 {
    max-width: 46vw;
  }

  .composer {
    padding: 10px 12px 12px;
  }

  .composer-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .composer-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
  }

  .send-button {
    min-width: 58px;
    padding-inline: 10px;
  }

  .tag-create-form,
  .report-kpis,
  .report-agent-row {
    grid-template-columns: 1fr;
  }

  .business-hours-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .report-bar-row {
    grid-template-columns: 74px 1fr 30px;
  }
}

@media (max-width: 420px) {
  .mobile-topbar {
    gap: 6px;
    padding: 0 8px;
  }

  .mobile-actions,
  .mobile-left-actions {
    gap: 5px;
  }

  .mobile-actions .ghost-button {
    min-height: 30px;
    padding: 5px 7px;
    font-size: 10.5px;
  }

  .mobile-brand {
    font-size: 12px;
  }

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

  .composer-row .icon-button {
    display: none;
  }

  .chat-header-actions .status-pill {
    display: none;
  }
}
