/* Dashboard RARO: adaptação para celular (até 760px).
   Carregado DEPOIS do CSS de cada página, por isso sobrepõe as regras de desktop. */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .container { padding: 14px 14px 28px; }

  /* Cabeçalho compacto */
  .header { padding: 16px 16px 14px; margin-bottom: 14px; border-radius: 12px; }
  .header::before { width: 140px; }
  .header h1 { font-size: 20px; letter-spacing: .6px; line-height: 1.1; }
  .header h1 span { font-size: 9px; letter-spacing: 2px; margin-top: 6px; }
  .header .logo-f4 { width: 42px; height: 42px; }

  /* Navegação: faixa rolável na horizontal, abas com 44px de toque */
  .sub-header { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 12px; border-bottom: none; margin-bottom: 18px; }
  .page-nav { min-width: 0; max-width: calc(100% + 28px); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 0; flex-wrap: nowrap; margin: 0 -14px; padding: 0 14px; border-bottom: 1px solid var(--border); }
  .page-nav::-webkit-scrollbar { display: none; }
  .page-nav a { flex: none; padding: 13px 14px; min-height: 44px; font-size: 11px; letter-spacing: 1.2px; white-space: nowrap; }
  .sub-header .filter-row { padding-bottom: 0; width: 100%; }

  /* Seletor de período: botão largo e painel como folha inferior */
  .pf { display: block; }
  .sub-header .filter-row > .pf { flex: 1; min-width: 0; }
  .pf-btn { width: 100%; height: 46px; font-size: 12px; }
  .pf-pop { position: fixed; left: 10px; right: 10px; top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); min-width: 0; padding: 14px; border-radius: 16px; z-index: 1200;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, .65), 0 0 0 100vmax rgba(0, 0, 0, .5); }
  .pf-all { padding: 14px; font-size: 12px; }
  .pf-grid { gap: 6px; }
  .pf-m { padding: 14px 4px; font-size: 12px; }
  .pf-foot { display: none; }

  /* Navegador de mês (Reuniões) */
  .month-nav { width: 100%; }
  .month-nav .btn { height: 46px; min-width: 46px; }
  .month-nav .month-label { flex: 1; min-width: 0; height: 46px; }

  /* KPIs em duas colunas */
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
  .kpi { padding: 14px 12px; border-radius: 12px; min-width: 0; }
  .kpi:hover { transform: none; box-shadow: none; }
  .kpi-icon { width: 30px; height: 30px; border-radius: 8px; margin-bottom: 8px; }
  .kpi-icon svg { width: 15px; height: 15px; }
  .kpi .label { font-size: 9px; letter-spacing: 1.2px; }
  .kpi .value { font-size: 22px; }
  .kpi .sub { font-size: 11px; line-height: 1.35; }

  /* Seções e cards */
  .section-title { font-size: 12.5px; letter-spacing: 1.8px; margin: 24px 0 12px; }
  .section-title--row { flex-wrap: wrap; gap: 8px 12px; }
  .legend { gap: 6px 12px; font-size: 9.5px; }
  .card, .motivos-card, .evo-card, .funil-card, .chart-card { padding: 16px 14px; margin-bottom: 22px; border-radius: 12px; }
  .dual-section, .cost-grid, .two-col, .dual-chart-rank, .atribuicao-grid { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 22px 0 0; }
  .dual-section > div, .cost-grid > div, .two-col > div, .dual-chart-rank > div { margin-bottom: 22px; min-width: 0; }
  .two-col .motivos-card, .dual-section .motivos-card, .dual-section .evo-card, .cost-grid .card, .dual-chart-rank .card { margin-bottom: 0; }

  /* Gráficos SVG: mantêm o tamanho de leitura e rolam na horizontal dentro do card */
  .semanal-chart, .evo-chart, .dual-chart, .chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .semanal-chart svg, .evo-chart svg, .dual-chart svg { min-width: 640px; }
  .chart-wrap { padding: 8px 0 4px; }
  .chart-wrap .chart-svg { min-width: 660px; }
  .semanal-legend, .evo-legend, .dual-legend, .chart-legend { gap: 8px 14px; flex-wrap: wrap; justify-content: flex-start; }

  /* Tabelas: rolagem horizontal dentro do card */
  .table-card, .card[style*="overflow-x"] { padding: 6px 0 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-card th:first-child, .table-card td:first-child, .card[style*="overflow-x"] th:first-child, .card[style*="overflow-x"] td:first-child { padding-left: 14px; }
  .table-card th:last-child, .table-card td:last-child { padding-right: 14px; }
  .camp-table { min-width: 660px; }
  .camp-table .camp-name { max-width: 240px; }
  .month-table { min-width: 880px; }
  .camp-table.contratos-table { min-width: 880px; }

  /* Funil (Comercial): rótulo em cima, barra embaixo */
  .funil-stages { gap: 13px; }
  .funil-row { flex-direction: column; align-items: stretch; gap: 5px; }
  .funil-label { width: auto; text-align: left; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .funil-label .desc { margin-top: 0; }
  .funil-connector { display: none; }
  .funil-track { height: 26px; }
  .funil-conv-tag { min-width: 40px; text-align: right; }
  .funil-summary { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .funil-summary .item { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
  .funil-summary .label { grid-column: 1; margin-bottom: 2px; letter-spacing: 1.6px; }
  .funil-summary .detail { grid-column: 1; margin-top: 0; font-size: 12px; }
  .funil-summary .value { grid-column: 2; grid-row: 1 / span 2; font-size: 30px; }

  /* Pista de rolagem lateral: fica parada no canto enquanto o conteúdo desliza */
  .table-card::after, .card[style*="overflow-x"]::after, .semanal-chart::after, .evo-chart::after, .dual-chart::after, .chart-wrap::after {
    content: '\2194  arraste para o lado'; display: block; position: sticky; left: 14px; width: max-content; margin: 8px 0 6px 14px;
    font-size: 9.5px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); }
  .semanal-chart::after, .evo-chart::after, .dual-chart::after, .chart-wrap::after { left: 0; margin-left: 0; }

  /* Donuts e ranking */
  .motivo-item { grid-template-columns: 12px minmax(0, 1fr) 40px 50px; gap: 8px; }
  .motivo-item .nome { font-size: 12.5px; }
  .rank-row { grid-template-columns: minmax(0, 1fr) 66px; }

  /* Rodapé */
  .footer { flex-wrap: wrap; gap: 4px 10px; padding: 20px 8px calc(20px + env(safe-area-inset-bottom)); font-size: 9px; letter-spacing: 1.4px; text-align: center; }

  /* Contratos: beneficiários em folha inferior */
  #ben-pop { position: fixed !important; left: 0 !important; right: 0; top: auto !important; bottom: 0; min-width: 0; max-width: none; max-height: 78vh; z-index: 1200;
    border-radius: 18px 18px 0 0; border-width: 1px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 48px rgba(0, 0, 0, .65), 0 0 0 100vmax rgba(0, 0, 0, .5); }
  #ben-pop .bp-head { flex-direction: column; gap: 4px; }
  #ben-pop .bp-sub { white-space: normal; }
  #ben-pop table, #ben-pop tbody, #ben-pop tr, #ben-pop td { display: block; }
  #ben-pop thead { display: none; }
  #ben-pop tbody td { padding: 2px 0; border: none; }
  #ben-pop tbody tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .btn-csv { height: 40px; }

  /* Reuniões: calendário vira agenda; a tabela sai (a agenda cobre o mesmo conteúdo) */
  .cal, .only-desktop { display: none !important; }
  .agenda { display: block; }

  /* Reuniões: painel de detalhe em folha inferior */
  #ev-panel { position: fixed !important; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-width: none; max-height: 86vh; z-index: 1200;
    border-radius: 18px 18px 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -12px 48px rgba(0, 0, 0, .65), 0 0 0 100vmax rgba(0, 0, 0, .5); }
  #ev-panel .p-head { position: sticky; top: 0; z-index: 1; padding: 18px 56px 12px 16px; background: var(--card); }
  #ev-panel .p-close { display: inline-flex; }
  #ev-panel .p-body { padding: 14px 16px 22px; }
  #ev-panel .p-grid { gap: 12px 14px; }
  #ev-panel .p-grid .p-item:nth-child(1), #ev-panel .p-grid .p-item:nth-child(2) { grid-column: 1 / -1; }
  #ev-panel .p-item .v { font-size: 13px; }
  #ev-panel .p-perfil, #ev-panel ul.p-list li, #ev-panel .p-next { font-size: 13.5px; }
  #ev-panel .p-actions .p-btn { height: 46px; flex: 1 1 140px; justify-content: center; font-size: 11px; }
}

/* toque: sem efeitos que dependem de passar o mouse */
@media (hover: none) {
  .kpi:hover, .card:hover { transform: none; box-shadow: none; }
}
