/* Laptop (Juliana, 31/10/2026: "a maioria usa laptop… não quero chegar pro lado").
   Só entre 861 e 1560 px. Tabelas cabem na largura: títulos quebram linha, células mais justas. */
@media (min-width:861px) and (max-width:1560px){
  /* Tabelas em geral: sem rolagem lateral */
  html body #main .cp-wrap>table th,
  html body #main .dcwrap table th,
  html body #main .dtabwrap table th{white-space:normal!important;padding:9px 7px!important;font-size:.72rem!important;line-height:1.25;vertical-align:bottom}
  html body #main .cp-wrap>table td,
  html body #main .dcwrap table td,
  html body #main .dtabwrap table td{padding:9px 7px!important}
  html body #main .cp-wrap>table td small{white-space:normal}
  html body #main .cp-wrap>table th button,html body #main .dtabwrap table th button,html body #main .ptab th button{white-space:normal!important;text-align:inherit}

  /* Insumos da loja: colunas fixas, nomes quebram */
  html body #main .cp-ins-tab:not(.ai-tab){table-layout:fixed;width:100%}
  html body #main .cp-ins-tab:not(.cp-ins-g):not(.ai-tab)>thead>tr>th:nth-child(1){width:22%}
  html body #main .cp-ins-tab:not(.cp-ins-g):not(.ai-tab)>thead>tr>th:nth-child(2){width:17%}
  html body #main .cp-ins-tab:not(.cp-ins-g):not(.ai-tab)>thead>tr>th:nth-child(3){width:13%}
  html body #main .cp-ins-tab:not(.cp-ins-g):not(.ai-tab)>thead>tr>th:nth-child(4){width:10%}
  html body #main .cp-ins-tab:not(.cp-ins-g):not(.ai-tab)>thead>tr>th:nth-child(5){width:14%}
  html body #main .cp-ins-tab:not(.cp-ins-g):not(.ai-tab)>thead>tr>th:nth-child(7){width:64px}
  html body #main .cp-ins-tab>tbody>tr>td{white-space:normal!important}
  html body #main .cp-ins-tab td.cp-r{white-space:normal!important}
  html body #main .cp-ins-tab td.cp-r>b,html body #main .cp-ins-tab td.cp-r>span{white-space:nowrap}
  html body #main .cp-ins-det{grid-template-columns:minmax(0,1fr)!important;max-height:none;overflow:visible}
  html body #main .cp-ins-det .cp-wrap{overflow-x:visible}
  html body #main .cp-ins-forn{table-layout:auto;font-size:.82rem}
  html body #main .cp-ins-forn th{white-space:normal!important;font-size:.7rem!important}
  html body #main .cp-ins-forn td{padding:7px 6px!important}

  /* Cartão "Insumo/Fornecedor que mais perde": nome em até 2 linhas, sem cortar */
  html body #main .cp-k .mk-v.mk-v{white-space:normal!important;overflow:visible;text-overflow:clip;font-size:clamp(1.05rem,1.45vw,1.4rem)!important;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

  /* Comparativos (DRE do Grupo, Dashboard do Grupo, Marcas) */
  html body #main .dcwrap table,html body #main .dtabwrap table{font-size:.82rem}
  html body #main .dtabwrap table td{white-space:normal!important}
  html body #main .dtabwrap table th,html body #main .dtabwrap table td{padding-left:4px!important;padding-right:4px!important}
  /* Ranking das lojas (Compras e perdas do Grupo): textos quebram, barra mais curta */
  html body #main .cpg-rank .cp-wrap>table td{white-space:normal!important}
  html body #main .cpg-rank .cp-wrap>table td:nth-child(3),html body #main .cpg-rank .cp-wrap>table td:nth-child(4),html body #main .cpg-rank .cp-wrap>table td:nth-child(7),html body #main .cpg-rank .cp-wrap>table td:nth-child(8){white-space:nowrap!important}
  html body #main .cpg-bar span{min-width:36px}
  html body #main .cpg-rank .cp-wrap>table th,html body #main .cpg-rank .cp-wrap>table td{min-width:0!important}
  html body #main .cpg-rank .cp-wrap>table td:nth-child(5){width:15%}
  /* Fornecedores do Grupo: etiquetas das lojas quebram linha */
  html body #main .cpt-ljc{min-width:0!important}
  html body #main .cp-wrap>table td .cpt-f b{white-space:normal}
  /* DRE comparativo: nome da conta quebra linha */
  html body #main .dcwrap table td:first-child,html body #main .dcwrap table th:first-child{white-space:normal!important}
  /* Precificação: mais justa */
  html body #main .ptab th,html body #main .ptab td{padding:8px 5px!important}
  html body #main .ptab th{font-size:.7rem!important;white-space:normal!important}
  html body #main .ptab table{min-width:0!important}
  html body #main .ptab .pin{display:flex;width:100%;max-width:100%}
  html body #main .ptab .pin input{width:100%;min-width:0}
  html body #main .ptab td{font-size:.8rem;overflow:hidden}
  html body #main .ptab .mk{font-size:.74rem;max-width:100%;white-space:nowrap}
  html body #main .ptab .mk i{display:none}
  /* Painel das Marcas: comparativo na largura toda, os outros dois lado a lado */
  html body #main .mb-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  html body #main .mb-grid>.panel:first-child{grid-column:1/-1}
  html body #main .dcwrap table td:first-child,html body #main .dcwrap table th:first-child{min-width:0!important;width:auto}
}
@media (min-width:861px) and (max-width:1200px){
  html body #main .cpg-rank .cp-wrap>table{font-size:.8rem}
  html body #main .cpg-rank .cp-wrap>table td{padding:8px 4px!important}
  html body #main .cpg-rank .cp-wrap>table td:nth-child(5){width:11%}
  html body #main .cpg-rank .cpg-bar{gap:5px}
  html body #main .cpg-rank .cpg-bar b{min-width:34px}
  html body #main .cpg-rank .cp-wrap>table th{padding:8px 4px!important;font-size:.64rem!important;letter-spacing:.02em}
  /* Dashboard do Grupo: tabela das lojas na largura toda */
  html body #main .drow.drow:has(.dtabwrap){grid-template-columns:minmax(0,1fr)!important}
}
/* Laptop com tela baixa: menu lateral mais justo para Acessos e Sair caberem */
@media (min-width:861px) and (max-height:860px){
  html body .side.side{gap:8px;padding-bottom:18px}
  html body .side.side::after{display:none}
  html body .side.side nav button{padding:7px 11px}
  html body .side.side .foot{margin-bottom:22px;padding-top:8px}
}
/* Compras e perdas, todas as telas de computador (Juliana, 31/10/2026: "e esse espaço?"):
   cada motivo numa linha só (nome · registros · valor) com a barra embaixo,
   para "Por que se perde" ficar da altura do gráfico "Perdas mês a mês". */
@media (min-width:861px){
  html body #main .drow .cp-bars-refined{gap:2px;margin-top:8px}
  html body #main .drow .cp-bar-card.cp-bar-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:baseline;column-gap:8px;row-gap:5px;padding:7px 10px}
  html body #main .drow .cp-bar-card .cp-bar-heading{display:contents}
  html body #main .drow .cp-bar-card .cp-bar-heading>span{grid-column:1;grid-row:1;font-size:.86rem}
  html body #main .drow .cp-bar-card .cp-bar-heading>strong{grid-column:3;grid-row:1;font-size:.9rem}
  html body #main .drow .cp-bar-card>small{grid-column:2;grid-row:1;margin:0;font-size:.72rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  html body #main .drow .cp-bar-card>small::before{content:"· "}
  html body #main .drow .cp-bar-card .cp-bar-track{grid-column:1/-1;grid-row:2;height:8px!important}
}
/* Pedidos › Fazer pedido no computador (Juliana, 31/10/2026: "está tampando tudo no monitor pequeno…
   tem que aparecer no final da tela, está fixa"): o resumo deixa de ser fixo e fica no fim da lista de produtos. */
@media (min-width:641px){
  html body #main .pd-resumo{position:static!important;margin-top:18px}
}
/* Dashboard (Juliana, 31/10/2026: "o quadrado tá branco"): no laptop, "Faturamento × custos" na largura toda
   e os cartões Resultado · Prazo médio · Ticket médio numa fileira embaixo (antes a coluna da direita
   ficava mais alta e deixava o gráfico com um vazio embaixo). */
@media (min-width:861px) and (max-width:1560px){
  html body #main .mk-row.mk-row:has(>.mk-stack){grid-template-columns:minmax(0,1fr)!important}
  html body #main .mk-row>.mk-stack.mk-stack{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;align-items:stretch}
  html body #main .mk-row>.mk-stack.mk-stack>*{margin:0!important}
  html body #main .mk-row>.mk-card .mk-abrir{margin-top:6px}
}
