/* Page-specific responsive corrections kept separate from the shared overflow contract. */
@media (max-width: 800px) {
  body[data-view="desempenho"] .main { padding: 16px !important; }
  body[data-view="desempenho"] .analytics {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: none !important;
    grid-template-rows: none !important;
    grid-auto-flow: row !important;
    height: auto !important;
  }
  body[data-view="desempenho"] .analytics > * {
    grid-area: auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
  }
  body[data-view="desempenho"] .topbar,
  body[data-view="nine-box"] .header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    height: auto !important;
    gap: 12px;
    padding-bottom: 8px;
  }
  body[data-view="desempenho"] .top-actions,
  body[data-view="nine-box"] .header-actions {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  body[data-view="desempenho"] .top-actions > .ctrl,
  body[data-view="nine-box"] .header-actions > .control {
    min-width: 0 !important;
    max-width: 100%;
    flex: 1 1 150px;
    margin-left: 0;
    height: auto;
    min-height: 40px;
    padding: 10px;
    white-space: normal;
  }
  body[data-view="desempenho"] :is(.panel-head,.rank-footer) {
    height: auto;
    min-height: 40px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  body[data-view="desempenho"] .kpi-row {
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body[data-view="nine-box"] .content { grid-template-rows: auto auto auto !important; }
  body[data-view="nine-box"] .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body[data-view="nine-box"] .kpi { grid-template-columns: 43px minmax(0, 1fr); }
  body[data-view="nine-box"] .kpi > div { min-width: 0; }
  body[data-view="nine-box"] .kpi :is(.label,.sub) { overflow-wrap: anywhere; }
  body[data-view="nine-box"] :is(.left,.right) { grid-template-rows: auto auto !important; }
  body[data-view="nine-box"] :is(.matrix-body,.lower-left,.dist-body,.components) { grid-template-columns: minmax(0,1fr) !important; }
  body[data-view="nine-box"] .matrix-wrap { min-width: 0; min-height: 430px; padding-left: 54px; }
  body[data-view="nine-box"] .axis-y { left: 0; width: 24px; }
  body[data-view="nine-box"] .axis-y-sub { left: 25px; }
  body[data-view="nine-box"] :is(.axis-x,.xlabels) { left: 54px; }
  body[data-view="nine-box"] .grid .cell { min-width: 0; padding: 6px 3px; }
  body[data-view="nine-box"] .grid .cell :is(strong,small) { overflow-wrap: anywhere; }
  body[data-view="nine-box"] .seller-body { grid-template-rows: auto auto auto auto; overflow: visible; }
  body[data-view="nine-box"] .seller-name { min-width: 0; overflow-wrap: anywhere; }
  body[data-view="nine-box"] .scores { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-view="nine-box"] .gauge { display: none; }
  body[data-view="nine-box"] .seller-evidence { height: auto; padding: 8px; white-space: normal; }
  body[data-view="nine-box"] .panel-head { height: auto; min-height: 39px; padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  body[data-view="nine-box"] .footerline { position: static; height: auto; min-height: 24px; flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 380px) {
  body[data-view="desempenho"] .kpi-row,
  body[data-view="nine-box"] .kpis {
    grid-template-columns: minmax(0,1fr) !important;
  }
}
