/* Boletim de medição por período.
   Paleta e box-model alinhados com validacao.css / correcao.css — é a mesma
   pessoa, na mesma sessão, alternando entre as telas. */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0 0 40px;
    background: #f8f9fa;
    color: #212529;
}

/* ── TOPO ── */
.topo {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: white;
    border-bottom: 3px solid #6f42c1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.btn-voltar {
    background: #e9ecef;
    color: #495057;
    flex-shrink: 0;
}

.btn-voltar:hover {
    background: #dee2e6;
}

.topo h1 {
    margin: 0;
    font-size: 20px;
}

.topo-sub {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: #6c757d;
}

button {
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primario {
    background: #6f42c1;
    color: white;
}

.btn-primario:hover:not(:disabled) {
    background: #59359a;
}

.btn-secundario {
    background: #e9ecef;
    color: #495057;
}

.btn-secundario:hover:not(:disabled) {
    background: #dee2e6;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── FILTROS ── */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filtros label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #868e96;
    font-weight: 600;
}

.filtros input,
.filtros select {
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: #212529;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.filtros input:focus,
.filtros select:focus {
    outline: none;
    border-color: #6f42c1;
}

.filtros select {
    max-width: 240px;
}

/* ── FAIXA DE RESUMO ── */
.faixa-resumo {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding: 14px 24px;
    background: white;
    border-bottom: 1px solid #dee2e6;
}

.resumo-item {
    font-size: 13px;
    font-weight: 600;
}

.resumo-item span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #868e96;
    font-weight: 400;
}

/* Selo de escopo restrito (fiscal que só enxerga as equipes dele). Amarelo, o
   mesmo tom do aviso de pendências: é informação de limite, não de erro.
   Seletor com `.resumo-item` na frente para vencer `.resumo-item span`, que
   transforma todo span filho no rotulinho cinza em caixa alta. */
.resumo-item .selo-escopo {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    background: #fff8e1;
    border: 1px solid #ffe08a;
    color: #7a5b00;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}

.resumo-criterio {
    flex: 1 1 320px;
    font-size: 12px;
    color: #6c757d;
    line-height: 1.45;
}

.resumo-acoes {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ── CONTEÚDO ── */
.conteudo {
    padding: 20px 24px;
}

.vazio {
    padding: 60px 20px;
    text-align: center;
    color: #868e96;
    font-size: 14px;
}

/* ── BLOCO DA EQUIPE ── */
.equipe {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 22px;
    overflow: hidden;
}

.equipe-cabecalho {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: baseline;
    padding: 13px 18px;
    background: #6f42c1;
    color: white;
}

.equipe-cabecalho h2 {
    margin: 0;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.equipe-cabecalho .equipe-meta {
    font-size: 12px;
    opacity: 0.85;
}

/* A tabela tem uma coluna por dia — em um mês fechado são 30 e não cabem na
   tela. A rolagem é DO BLOCO, não da página: assim o cabeçalho do topo e a
   faixa de resumo continuam visíveis enquanto se rola de lado. */
.tabela-rolagem {
    overflow: auto;
    max-height: 74vh;
    cursor: grab;
}

/* Aplicada via JS (arrastar.js) enquanto o botão está pressionado e o mouse já
   se moveu além do limiar de arraste — não no mousedown puro, senão um
   clique comum já mudaria o cursor para "grabbing" por um instante. */
.tabela-rolagem.arrastando {
    cursor: grabbing;
    user-select: none;
}

table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    white-space: nowrap;
}

th,
td {
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    padding: 6px 8px;
    background: white;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f1f3f5;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #495057;
    text-align: center;
}

/* Altura fixada, e não deixada ao conteúdo, porque a faixa de baixo se ancora
   nela: com altura calculada pelo texto, qualquer mudança de fonte abriria uma
   fresta entre as duas faixas por onde a tabela apareceria ao rolar. */
thead tr:first-child th {
    height: 28px;
}

/* Segunda faixa do cabeçalho (dia da semana) precisa do próprio deslocamento,
   senão ela some sob a primeira ao rolar. 28px = altura fixada acima. */
thead tr.linha-semana th {
    top: 28px;
    font-weight: 600;
    color: #868e96;
    font-size: 10px;
}

/* ── COLUNAS FIXAS ──
   LINHA / DESCRIMINAÇÃO / UNID. acompanham a rolagem horizontal: sem isso,
   ao chegar no dia 20 já não se sabe de qual atividade é a linha.
   Os `left` são a soma das larguras das colunas anteriores — mexer numa
   largura exige mexer no `left` da seguinte. */
.col-linha {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 74px;
    min-width: 74px;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.col-descricao {
    position: sticky;
    left: 74px;
    z-index: 2;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    text-align: left;
    white-space: normal;
    line-height: 1.35;
}

.col-unidade {
    position: sticky;
    left: 394px;
    z-index: 2;
    width: 58px;
    min-width: 58px;
    text-align: center;
    border-right: 2px solid #dee2e6;
}

/* Cabeçalho é fixo nos dois eixos ao mesmo tempo — precisa vencer tanto o
   thead comum quanto as colunas fixas do corpo. */
thead .col-linha,
thead .col-descricao,
thead .col-unidade {
    z-index: 4;
    background: #f1f3f5;
}

.col-dia {
    width: 56px;
    min-width: 56px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Sábado e domingo saem da própria data. Feriado NÃO é marcado: o sistema não
   tem tabela de feriados (na planilha isso é digitado à mão). */
.col-dia.fim-de-semana {
    background: #f8f9fa;
}

thead .col-dia.fim-de-semana {
    background: #e9ecef;
}

.col-quant {
    position: sticky;
    right: 0;
    z-index: 2;
    width: 92px;
    min-width: 92px;
    text-align: right;
    font-weight: 700;
    background: #f8f9fa;
    border-left: 2px solid #dee2e6;
    font-variant-numeric: tabular-nums;
}

thead .col-quant {
    z-index: 4;
    background: #f1f3f5;
}

/* ── LINHAS ── */
.linha-grupo td {
    background: #ede7f6;
    padding: 8px 10px;
}

/* Sticky no RÓTULO, não na célula: o td tem colspan e já ocupa a largura toda
   da tabela, então fixá-lo não moveria nada. Quem precisa acompanhar a rolagem
   horizontal é o texto do grupo. */
.linha-grupo .grupo-rotulo {
    position: sticky;
    left: 10px;
    display: inline-block;
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #4a2b8c;
}

.linha-atividade:hover td {
    background: #f8f5ff;
}

.linha-atividade:hover .col-quant {
    background: #efe7ff;
}

/* Célula sem lançamento fica apagada de propósito: o que importa na leitura é
   onde teve produção, não o mar de vazios em volta. */
.sem-valor {
    color: #ced4da;
}

.linha-total td {
    background: #f1f3f5;
    font-weight: 700;
    border-top: 2px solid #dee2e6;
}

.linha-total .col-quant {
    background: #e9ecef;
}

/* ── AVISO DE PENDÊNCIA ── */
.aviso {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 12px 16px;
    background: #fff8e1;
    border: 1px solid #ffe08a;
    border-radius: 6px;
    font-size: 12.5px;
    color: #7a5b00;
    line-height: 1.5;
}

.aviso ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

/* ── TOAST ── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 13px 18px;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    z-index: 80;
    max-width: 380px;
}

.toast-sucesso {
    background: #28a745;
}

.toast-erro {
    background: #dc3545;
}
