:root {
  --azul: #1F2352;
  --azul-claro: #2e3474;
  --azul-fundo: #f4f5fa;
  --dourado: #C79A3C;
  --dourado-claro: #e3c583;
  --verde: #2e7d32;
  --vermelho: #b3261e;
  --cinza: #6b6f80;
  --borda: #e2e4ee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--azul-fundo);
  color: #22243a;
  min-height: 100vh;
}

.escondido { display: none !important; }

/* ---------- cabecalho ---------- */
header {
  background: var(--azul);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 28px;
  box-shadow: 0 2px 10px rgba(31, 35, 82, .35);
}

.marca { display: flex; align-items: center; gap: 14px; }

.logo-placa {
  background: #fff;
  border-radius: 12px;
  padding: 8px 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.logo-placa img { height: 34px; display: block; }

.marca h1 { font-size: 22px; font-weight: 600; letter-spacing: .5px; }
.marca h1 span { color: var(--dourado); font-weight: 700; }
.marca p { font-size: 12px; color: #c8cbe0; }

nav { display: flex; gap: 8px; flex-wrap: wrap; }

.aba {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: #dfe1f0;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.aba:hover { border-color: var(--dourado); color: #fff; }
.aba.ativa { background: var(--dourado); border-color: var(--dourado); color: var(--azul); font-weight: 600; }

.usuario-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #dfe1f0; }
.usuario-chip strong { color: var(--dourado-claro); }

.btn-mini {
  background: transparent; border: 1px solid rgba(255,255,255,.25);
  color: #dfe1f0; padding: 5px 12px; border-radius: 999px;
  cursor: pointer; font-size: 12px;
}
.btn-mini:hover { border-color: var(--dourado); color: #fff; }

main { padding: 22px 28px; max-width: 1200px; margin: 0 auto; display: grid; gap: 18px; }
section { display: grid; gap: 18px; }

/* ---------- cartoes ---------- */
.cartao {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 1px 4px rgba(31,35,82,.06);
}
.cartao h2 { color: var(--azul); font-size: 17px; margin-bottom: 12px; }
.cartao-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cartao-topo h2 { margin-bottom: 0; }

.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .duas-colunas { grid-template-columns: 1fr; } }

.texto-suave { color: var(--cinza); font-size: 13px; line-height: 1.6; margin-bottom: 10px; }

/* ---------- estatisticas ---------- */
.grade-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat {
  background: #fff; border: 1px solid var(--borda); border-radius: 14px;
  padding: 16px 18px;
}
.stat .valor { font-size: 26px; font-weight: 700; color: var(--azul); }
.stat .rotulo { font-size: 12px; color: var(--cinza); margin-top: 2px; }
.stat.alerta .valor { color: var(--vermelho); }
.stat.ok .valor { color: var(--verde); }

/* ---------- botoes e formularios ---------- */
.btn {
  background: #fff; border: 1.5px solid var(--borda); color: var(--azul);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: var(--dourado); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primario { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }
.btn-primario:hover { background: var(--azul-claro); }
.btn-perigo { color: var(--vermelho); }
.linha-botoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

input, select {
  padding: 10px 12px; font-size: 14px;
  border: 1.5px solid var(--borda); border-radius: 10px; background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--dourado); }
.busca { width: 100%; margin-bottom: 14px; }

.form-inline { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.form-inline input { flex: 1; min-width: 180px; }

.aviso {
  background: #fdecea; color: var(--vermelho);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 12px;
}
.resultado-ok {
  background: #e8f5e9; color: var(--verde);
  border-radius: 8px; padding: 14px 16px; font-size: 14px; line-height: 1.7;
}

/* ---------- tabelas ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--cinza); font-weight: 600; font-size: 12px;
  padding: 8px 10px; border-bottom: 2px solid var(--borda); white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
tr:hover td { background: #fafbff; }
.tabela-rolagem { overflow-x: auto; margin-top: 12px; }

.foto-mini {
  width: 44px; height: 44px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--borda); background: #f0f0f5;
}
.sem-foto {
  width: 44px; height: 44px; border-radius: 8px; border: 1px dashed #ccc;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #aaa; text-align: center;
}

.etiqueta {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.etiqueta.ativa { background: #e8f5e9; color: var(--verde); }
.etiqueta.inativa { background: #f0f0f5; color: var(--cinza); }
.etiqueta.pendente { background: #fdecea; color: var(--vermelho); }
.etiqueta.auto { background: #e7ebfd; color: var(--azul); }

/* ---------- importadoras ---------- */
.importadora-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 6px; border-bottom: 1px solid var(--borda); flex-wrap: wrap;
}
.importadora-item:last-child { border-bottom: 0; }
.importadora-nome { font-weight: 600; color: var(--azul); font-size: 15px; }
.importadora-sub { font-size: 12px; color: var(--cinza); margin-top: 2px; }

/* ---------- importacao ---------- */
.mapa-colunas { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.mapa-colunas label { font-size: 13px; color: var(--cinza); display: flex; flex-direction: column; gap: 5px; }

/* ---------- pendencias ---------- */
.pendencia-item { padding: 12px 6px; border-bottom: 1px solid var(--borda); }
.pendencia-item:last-child { border-bottom: 0; }
.pendencia-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pendencia-ref { font-weight: 600; color: var(--azul); }
.pendencia-busca { margin-top: 10px; }
.candidato {
  display: flex; align-items: center; gap: 10px; padding: 7px 6px;
  border-bottom: 1px dashed var(--borda); font-size: 13px;
}
.candidato:last-child { border-bottom: 0; }

/* ---------- acoes ---------- */
.lista-acoes { font-size: 12.5px; color: var(--cinza); display: grid; gap: 7px; max-height: 320px; overflow-y: auto; }
.lista-acoes b { color: #22243a; font-weight: 600; }

/* ---------- modal ---------- */
.veu {
  position: fixed; inset: 0; background: rgba(20, 22, 50, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: #fff; border-radius: 16px; padding: 26px 28px;
  width: min(420px, 94vw); box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.modal h2 { color: var(--azul); font-size: 18px; margin-bottom: 8px; }
.modal label { display: block; font-size: 13px; color: var(--cinza); margin: 12px 0 5px; }
.modal input { width: 100%; }
.modal .btn { width: 100%; margin-top: 18px; }

/* ---------- andamento ao vivo dos serviços ---------- */
.linha-andamento { padding: 14px 0; border-bottom: 1px solid var(--linha, #e2e4ef); }
.linha-andamento:last-child { border-bottom: 0; }
.andamento-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.andamento-topo strong { text-transform: none; }
.barra { height: 8px; border-radius: 99px; background: #eceef6; overflow: hidden; }
.barra-cheia { height: 100%; background: #1F2352; border-radius: 99px; transition: width .4s ease; }
.etiqueta { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: #eceef6; color: #6b6f8a; white-space: nowrap; }
.etiqueta.ok { background: #e6f4ec; color: #1c7a45; }
.etiqueta.alerta { background: #fdf0e3; color: #9a5b12; }
.titulo-bloco { margin: 22px 0 4px; font-size: 14px; letter-spacing: .5px; text-transform: uppercase; color: #6b6f8a; font-weight: 600; }

/* Relatorio mensal: cartoes, anel de progresso, atividade por dia e chips */
.relatorio-mes {
  margin: 14px 0 22px; padding: 20px 22px; border-radius: 16px;
  background: linear-gradient(135deg, #1F2352 0%, #2e3474 100%); color: #fff;
  box-shadow: 0 6px 22px rgba(31, 35, 82, .25);
}
.relatorio-cabeca { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.relatorio-titulo { margin: 0 0 2px; font-size: 19px; }
.relatorio-mes .sub { color: #c6c9e6; }
.anel {
  --pct: 0; width: 74px; height: 74px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(#C79A3C calc(var(--pct) * 1%), rgba(255,255,255,.15) 0);
  display: grid; place-items: center; position: relative;
}
.anel::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #262b63; }
.anel span { position: relative; font-weight: 700; font-size: 16px; }
/* placar por marca: % de problemas resolvidos, expande para feito/falta */
.relatorio-placar { margin: 16px 0 4px; }
.marca-situacao { border-radius: 10px; overflow: hidden; }
.marca-situacao[open] { background: rgba(0,0,0,.18); margin: 4px 0; }
.marca-linha {
  display: flex; align-items: center; gap: 12px; padding: 7px 10px;
  cursor: pointer; list-style: none; border-radius: 10px; transition: background .15s ease;
}
.marca-linha::-webkit-details-marker { display: none; }
.marca-linha:hover { background: rgba(255,255,255,.08); }
.marca-nome { flex: 0 0 96px; font-weight: 700; font-size: 14px; }
.marca-trilho { flex: 1; height: 10px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.marca-cheia { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #C79A3C, #e3c98a); transition: width .4s ease; }
.marca-pct { flex: 0 0 46px; text-align: right; font-weight: 700; color: #e3c98a; font-size: 14px; }
.marca-detalhe { padding: 4px 12px 12px 118px; }
.marca-item { font-size: 13px; padding: 3px 0; color: #c6c9e6; }
.marca-item.feito { color: #9fd7b4; }
.marca-item.falta { color: #f0c896; }
@media (max-width: 640px) { .marca-detalhe { padding-left: 12px; } }

.relatorio-cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0 14px; }
.cartao-kpi {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 12px 14px; transition: transform .15s ease, background .15s ease;
}
.cartao-kpi:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); }
.kpi-valor { font-size: 26px; font-weight: 700; color: #e3c98a; }
.kpi-rotulo { font-size: 12px; color: #c6c9e6; margin-top: 2px; }
.relatorio-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-marca {
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff;
  border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s ease, transform .1s ease; font-family: inherit;
}
.chip-marca:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.chip-marca.ativo { background: #C79A3C; border-color: #C79A3C; color: #1F2352; font-weight: 700; }
.chip-marca span { opacity: .75; font-size: 12px; margin-left: 4px; }
.chip-marca.ativo span { opacity: 1; }
/* Historico por mes: um botao por mes que abre os servicos daquele mes */
.mes-andamento { margin: 10px 0; border: 1px solid #e2e4ef; border-radius: 12px; background: #fff; overflow: hidden; }
.botao-mes {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px; cursor: pointer; list-style: none; user-select: none;
  background: #f4f5fa; transition: background .15s ease;
}
.botao-mes::-webkit-details-marker { display: none; }
.botao-mes:hover { background: #eceef6; }
.mes-nome { font-weight: 700; color: #1F2352; text-transform: capitalize; font-size: 15px; }
.mes-nome::before { content: '▸ '; font-size: 12px; color: #6b6f8a; }
.mes-andamento[open] .mes-nome::before { content: '▾ '; }
.mes-corpo { padding: 4px 18px 12px; }

/* selinho do espelhador de logs (infra, não tarefa) */
.selo-espelho {
  margin-left: 12px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
  opacity: 0.8;
}
.selo-espelho.selo-ok { background: #e6f6ea; color: #1d7a35; }
.selo-espelho.selo-off { background: #fdeaea; color: #a12626; }
