.filter-toggle {
  display: none;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
    background: #ffffff;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    max-height: none;
    padding: 16px;
    border-bottom: 4px solid var(--primary);
  }

  .brand-block {
    grid-template-columns: 140px 1fr;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
  }

  .brand-logo {
    width: 140px;
  }

  .brand-block h1 {
    font-size: 18px;
  }

  .filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    padding: 0 12px;
    background: #1a1a1a;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
  }

  .filter-toggle span {
    color: #ffffff;
    font-size: 13px;
    text-transform: uppercase;
  }

  .filter-toggle strong {
    color: #ff3a44;
    font-size: 13px;
  }

  .sidebar .filter-panel {
    display: none;
  }

  .sidebar.filters-open .filter-panel {
    display: grid;
  }

  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
  }

  .filter-panel label,
  .multi-filter {
    min-width: 0;
  }

  .filter-panel button,
  .multi-filter,
  .filter-panel label:has(#clientSearch) {
    grid-column: 1 / -1;
  }

  .dashboard {
    padding: 16px;
    overflow: visible;
  }

  .topbar {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .status-pill {
    width: fit-content;
    max-width: 100%;
    white-space: normal;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 13px;
  }

  .kpi strong {
    font-size: 24px;
  }

  .main-grid,
  .insight-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .panel {
    padding: 14px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  }

  .panel-header,
  .detail-heading {
    display: grid;
    gap: 10px;
  }

  .geo-map {
    height: 360px;
  }

  .donut {
    width: 180px;
    height: 180px;
  }

  .donut::after {
    inset: 36px;
  }

  .bar-row,
  .compact .bar-row,
  .status-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 4px 0;
  }

  .bar-label,
  .rank-title {
    white-space: normal;
  }

  .bar-value,
  .status-value {
    text-align: left;
  }

  .legend-row {
    grid-template-columns: 12px 1fr;
  }

  .legend-row strong {
    grid-column: 2;
  }

  .state-row {
    grid-template-columns: 44px 1fr;
  }

  .state-row .bar-track,
  .state-value {
    grid-column: 2;
  }

  .state-value {
    text-align: left;
  }

  .client-list {
    max-height: 420px;
  }

  .detail-metrics {
    justify-content: flex-start;
  }

  .table-tools {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: 520px;
    overflow: auto;
  }

  table {
    min-width: 680px;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding: 14px;
  }

  .brand-block {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    width: 168px;
  }

  .filter-panel,
  .date-filter-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard {
    padding: 12px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .panel-header h3 {
    font-size: 16px;
  }

  .geo-map {
    height: 310px;
  }

  .rank-item {
    grid-template-columns: 28px 1fr;
  }

  .rank-item strong {
    grid-column: 2;
  }

  .detail-metrics span {
    width: calc(50% - 4px);
  }
}
