:root {
  /* identidade Quality: grafite + verde-limão */
  --azul: #3a3737; --azul-2: #5b5757; --azul-claro: #eef3e4;
  --lima: #97d222; --lima-escuro: #6c9a12;
  --verde: #4f8a10; --verde-claro: #eaf5d6; --ambar: #b7791f; --ambar-claro: #fdf3e1;
  --vermelho: #b83a3a; --vermelho-claro: #fbe9e9; --roxo: #6a4fb3; --roxo-claro: #efeafb;
  --fundo: #f4f6f8; --cartao: #fff; --texto: #1d2433; --suave: #5d6878; --linha: #e2e6eb;
  --raio: 12px; --sombra: 0 1px 2px rgba(16,30,50,.06), 0 2px 8px rgba(16,30,50,.05);
  --fonte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); font-family: var(--fonte); font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--azul-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.carregando { padding: 60px 20px; text-align: center; color: var(--suave); }
.num { font-variant-numeric: tabular-nums; }
.suave { color: var(--suave); } .peq { font-size: 12.5px; } .neg { font-weight: 600; }
.verde { color: var(--verde); } .vermelho { color: var(--vermelho); } .ambar { color: var(--ambar); }

/* estrutura */
.topo { position: sticky; top: 0; z-index: 20; background: #2f2d2d; border-bottom: 3px solid var(--lima); color: #fff; padding: 10px 16px calc(10px); padding-top: calc(10px + env(safe-area-inset-top)); }
.topo-linha { display: flex; align-items: center; gap: 10px; }
.marca { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.marca { flex-direction: column; align-items: flex-start; gap: 2px; }
.marca-logo { height: 24px; width: auto; display: block; }
.marca-nome { font-size: 11.5px; font-weight: 600; letter-spacing: .3px; color: var(--lima); }
.topo-filtros { display: flex; gap: 8px; margin-top: 8px; }
.topo-filtros select { flex: 1; min-width: 0; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 7px 8px; font-size: 14px; }
.topo-filtros select option { color: var(--texto); }
.espaco { flex: 1; }
.btn-topo { background: none; border: 0; color: #fff; padding: 6px; border-radius: 8px; cursor: pointer; font-size: 14px; opacity: .9; }
.conteudo { padding: 14px 16px 90px; max-width: 1180px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--linha); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; text-align: center; padding: 8px 2px 7px; font-size: 11.5px; color: var(--suave); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nav a svg { width: 22px; height: 22px; }
.nav a.ativo { color: var(--azul); font-weight: 600; }
.nav a.ativo svg { color: var(--lima-escuro); }
.t-ofertar { background: #fff6d6; color: #7a5a00; }
ol.ofertar { margin: 0; padding-left: 22px; }
ol.ofertar li { padding: 6px 0; border-top: 1px solid var(--linha); font-size: 14px; }
ol.ofertar li:first-child { border-top: 0; }
ol.ofertar li::marker { color: var(--lima-escuro); font-weight: 700; }
@media (min-width: 900px) {
  body { padding-left: 210px; }
  .nav { top: 0; bottom: 0; right: auto; width: 210px; flex-direction: column; border-top: 0; border-right: 1px solid var(--linha); padding-top: 82px; }
  .nav a { flex: none; flex-direction: row; gap: 10px; padding: 11px 20px; font-size: 14.5px; text-align: left; }
  .topo { margin-left: -210px; padding-left: 226px; z-index: 40; }
  .topo-linha .marca { position: fixed; left: 0; top: 0; width: 210px; height: 66px; padding: 14px 18px; background: #2f2d2d; z-index: 40; justify-content: center; }
  .topo-filtros { margin-top: 0; max-width: 560px; }
  .topo-flex { display: flex; align-items: center; gap: 16px; }
  .conteudo { padding: 20px 24px 40px; }
}

/* cartões e grade */
.cartao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 14px; margin-bottom: 12px; }
.cartao-tit { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cartao-tit h2 { font-size: 15.5px; }
.grade { display: grid; gap: 12px; }
@media (min-width: 700px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } }
.g2m { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .g2m.g4 { grid-template-columns: repeat(4, 1fr); } }
.grade > .cartao { margin-bottom: 0; }
.mb { margin-bottom: 12px; }

/* números grandes */
.kpi-rot { font-size: 12.5px; color: var(--suave); }
.kpi-val { font-size: 22px; font-weight: 700; margin-top: 2px; }
.kpi-sub { font-size: 12.5px; color: var(--suave); margin-top: 2px; }
.destaque { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 18px; }
.destaque .kpi-val { font-size: 30px; }
.ritmo-faixa { display: inline-flex; gap: 6px; align-items: center; background: var(--azul-claro); color: var(--azul); border-radius: 20px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; }

/* barras de meta */
.barras { display: grid; gap: 12px; margin-top: 12px; }
.barra-cab { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; gap: 8px; }
.barra-cab b { font-weight: 600; }
.barra { position: relative; height: 12px; background: #edf0f3; border-radius: 8px; overflow: visible; }
.barra-fill { height: 100%; border-radius: 8px; background: var(--lima-escuro); transition: width .6s ease; max-width: 100%; }
.barra-fill.ambar { background: #d69e2e; } .barra-fill.vermelho { background: #d05a5a; } .barra-fill.cinza { background: #b8c0ca; }
.barra-marca { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--azul); border-radius: 2px; }
.barra-marca::after { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--azul); }
.barra-leg { font-size: 11.5px; color: var(--suave); margin-top: 3px; }
.barra-vazia { font-size: 12.5px; color: var(--suave); padding: 4px 0; }

/* chips e etiquetas */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--linha); background: #fff; border-radius: 20px; padding: 7px 12px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.chip.ativo { background: var(--azul); color: #fff; border-color: var(--azul); }
.chip b { margin-left: 4px; }
.oport { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 700px) { .oport { grid-template-columns: repeat(6, 1fr); } }
.oport a { border-radius: 10px; padding: 10px; display: block; color: inherit; }
.oport .n { font-size: 22px; font-weight: 700; }
.oport .r { font-size: 12px; }
.t-ligar { background: var(--azul-claro); color: var(--azul); }
.t-atrasado { background: var(--ambar-claro); color: #8a5a12; }
.t-inativo { background: var(--vermelho-claro); color: var(--vermelho); }
.t-caindo { background: #fdeee6; color: #a24b1c; }
.t-crescendo { background: var(--verde-claro); color: var(--verde); }
.t-novo { background: var(--roxo-claro); color: var(--roxo); }
.tag { display: inline-block; border-radius: 6px; padding: 2px 7px; font-size: 11.5px; font-weight: 600; margin: 2px 4px 0 0; }

/* listas */
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { border-top: 1px solid var(--linha); }
.lista > li:first-child { border-top: 0; }
.item { display: flex; gap: 10px; padding: 11px 0; color: inherit; align-items: flex-start; }
.item-corpo { flex: 1; min-width: 0; }
.item-nome { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.item-sub { font-size: 12.5px; color: var(--suave); margin-top: 2px; }
.item-dir { text-align: right; flex: none; font-size: 14px; }
.item-dir .peq { display: block; }
.motivo { font-size: 13px; margin-top: 4px; color: var(--texto); }

/* tabelas */
.tabela-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--suave); padding: 7px 8px; border-bottom: 1px solid var(--linha); white-space: nowrap; }
table.t td { padding: 8px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.clicavel { cursor: pointer; }
table.t tr.clicavel:hover td { background: #f8fafc; }

/* gráfico */
.graf svg { width: 100%; height: auto; display: block; }
.graf text { font-family: var(--fonte); }
.tipo-linha { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-bottom: 9px; font-size: 13.5px; }
.tipo-barra { grid-column: 1 / -1; height: 8px; background: #edf0f3; border-radius: 6px; overflow: hidden; }
.tipo-barra div { height: 100%; background: var(--azul-2); border-radius: 6px; }

/* formulários */
.campo { margin-bottom: 12px; }
.campo label { display: block; font-size: 13px; color: var(--suave); margin-bottom: 4px; }
.campo input, .campo select, .campo textarea, .entrada { width: 100%; border: 1px solid #cfd6de; border-radius: 9px; padding: 10px 11px; background: #fff; font-size: 15px; }
.campo input:focus, .entrada:focus, select:focus { outline: 2px solid #9cc3e6; border-color: var(--azul-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 9px; padding: 10px 16px; background: var(--azul); color: #fff; font-weight: 600; cursor: pointer; font-size: 14.5px; }
.btn.verde { background: var(--lima); color: #2f2d2d; } .btn.sec { background: #fff; color: var(--azul); border: 1px solid #c4d0dc; } .btn.perigo { background: var(--vermelho); }
.btn.peq { padding: 6px 11px; font-size: 13px; } .btn.larga { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.busca { display: flex; gap: 8px; margin-bottom: 10px; }
.busca input, .busca select { flex: 1; min-width: 0; }
.busca select { flex: 0 0 auto; width: auto; max-width: 48%; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.check input { width: 18px; height: 18px; }

/* login */
.tela-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; background: radial-gradient(circle at 85% 10%, rgba(151,210,34,.35), transparent 45%), linear-gradient(160deg, #2f2d2d, #444141 70%); }
body.sem-nav { padding-left: 0; }
.login-caixa { background: #fff; border-radius: 16px; padding: 26px 22px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-caixa .marca { color: var(--azul); margin-bottom: 18px; font-size: 18px; }
.login-caixa .marca-logo { height: 34px; }
.login-caixa .marca-nome { color: var(--lima-escuro); font-size: 13px; }
.msg { border-radius: 9px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.msg.erro { background: var(--vermelho-claro); color: var(--vermelho); }
.msg.ok { background: var(--verde-claro); color: var(--verde); }
.msg.info { background: var(--azul-claro); color: var(--azul); }
.msg.alerta { background: var(--ambar-claro); color: #7a4e0f; }

/* modal e aviso */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,25,40,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-caixa { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); position: relative; }
@media (min-width: 700px) { .modal { align-items: center; } .modal-caixa { border-radius: 16px; } }
.modal-fechar { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px; color: var(--suave); cursor: pointer; }
.aviso { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 60; background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.aviso.erro { background: var(--vermelho); }

.vazio { text-align: center; color: var(--suave); padding: 24px 10px; font-size: 14px; }
.sep { height: 1px; background: var(--linha); margin: 12px 0; }
.voltar { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; margin-bottom: 10px; }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 10px; background: var(--vermelho); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.menu-admin a { display: flex; justify-content: space-between; align-items: center; padding: 13px 2px; border-top: 1px solid var(--linha); color: inherit; font-size: 15px; }
.menu-admin a:first-child { border-top: 0; }
.mais { text-align: center; margin-top: 8px; }
