/* Relatório de fluxo de RDOs por equipe/período.
   Mesma paleta e box-model de medicao.css / validacao.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);
}

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

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

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-voltar {
    background: #e9ecef;
    color: #495057;
    flex-shrink: 0;
}

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

.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;
}

.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.5;
}

.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;
}

/* ── CARTÕES DE TOTAL ── */
.cartoes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.cartao {
    background: white;
    border-radius: 8px;
    border-left: 4px solid #adb5bd;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 14px 16px;
}

.cartao-valor {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.cartao-rotulo {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.cartao-detalhe {
    margin-top: 3px;
    font-size: 10.5px;
    color: #868e96;
    line-height: 1.35;
}

.cartao.neutro   { border-left-color: #adb5bd; }
.cartao.ok       { border-left-color: #4c6ef5; }
.cartao.bom      { border-left-color: #2f9e44; }
.cartao.bom .cartao-valor { color: #2f9e44; }
.cartao.ruim     { border-left-color: #e03131; }
.cartao.ruim .cartao-valor { color: #e03131; }
.cartao.espera   { border-left-color: #f59f00; }
.cartao.alerta   { border-left-color: #e8590c; background: #fff4e6; }

/* ── TABELA ── */
.tabela-rolagem {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    width: 100%;
    white-space: nowrap;
}

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

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

thead .grupo-col {
    background: #ede7f6;
    color: #4a2b8c;
}

.col-equipe {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    min-width: 230px;
    background: white;
}

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

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

.col-num.col-rdos {
    font-weight: 700;
    background: #f8f9fa;
}

.zero {
    color: #ced4da;
}

tbody tr:hover td {
    background: #f8f5ff;
}

tbody tr:hover .col-equipe {
    background: #f8f5ff;
}

.destaque-ok    { color: #364fc7; }
.destaque-bom   { color: #2f9e44; font-weight: 700; }
.destaque-ruim  { color: #e03131; font-weight: 700; }

/* Linha de equipe fora do padrão de cadastro (escopo antigo). */
.linha-fora .col-equipe {
    font-style: italic;
    color: #7a5b00;
}

.selo-fora {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 20px;
    background: #fff8e1;
    border: 1px solid #ffe08a;
    color: #7a5b00;
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

tfoot td {
    position: sticky;
    bottom: 0;
    background: #f1f3f5;
    font-weight: 700;
    border-top: 2px solid #dee2e6;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

tfoot .col-equipe {
    text-align: left;
    z-index: 2;
}

/* ── AVISO ── */
.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 p {
    margin: 4px 0 0;
}

/* ── 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;
}

/* ── DRILL-DOWN: célula clicável + painel de RDOs ────────────────────── */

.celula-abrivel {
    cursor: pointer;
}

.celula-abrivel:hover {
    background: #ede7f6;
    box-shadow: inset 0 0 0 1px #b39ddb;
}

.celula-abrivel:focus-visible {
    outline: 2px solid #6f42c1;
    outline-offset: -2px;
}

/* Célula com o painel aberto logo abaixo. */
.celula-ativa,
.celula-ativa:hover {
    background: #6f42c1;
    color: #fff;
    box-shadow: none;
}

.celula-ativa .zero {
    color: #d9c9f2;
}

.linha-detalhe > td {
    padding: 0;
    background: #faf7ff;
    border-bottom: 2px solid #d7c8f0;
    white-space: normal;
}

.detalhe-cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    font-size: 12.5px;
    color: #4a2b8c;
    background: #efe7fb;
}

.detalhe-fechar {
    border: none;
    background: transparent;
    color: #4a2b8c;
    font-size: 14px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
}

.detalhe-fechar:hover {
    background: #ddcdf3;
}

.detalhe-rolagem {
    overflow-x: auto;
    padding: 4px 14px 14px;
}

.tabela-detalhe {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11.5px;
    white-space: nowrap;
}

.tabela-detalhe th {
    position: static;
    background: transparent;
    text-align: left;
    padding: 6px 10px;
    font-size: 10px;
    color: #6c757d;
    border-bottom: 1px solid #d7c8f0;
}

.tabela-detalhe td {
    background: transparent;
    border: none;
    border-bottom: 1px solid #ece3fb;
    padding: 6px 10px;
}

.tabela-detalhe tr:last-child td {
    border-bottom: none;
}

.tabela-detalhe .rdo-cod {
    font-weight: 700;
    color: #4a2b8c;
}

.tabela-detalhe .marca-nao {
    color: #e03131;
    font-weight: 700;
}

/* Motivo é texto livre (às vezes um parágrafo) — trunca com "..." na célula,
   o title da span (montarLinhaRdo) mostra o texto inteiro no hover. */
.tabela-detalhe .rdo-motivo {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detalhe-vazio {
    margin: 0;
    padding: 12px 14px 16px;
    font-size: 12px;
    color: #6c757d;
}
