/*
 * painel.css — layout e componentes do painel MobQ.
 * Todas as cores vêm de tokens.css (nenhum hexadecimal aqui).
 */

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

body {
  background: var(--fundo0);
  color: var(--texto1);
  font-family: var(--fonte);
  font-size: var(--t-corpo);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--marca-viva); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================ LOGIN ============================ */
.entrada {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1100px 560px at 72% -12%, var(--marca-suave) 0%, var(--fundo0) 58%);
  padding: var(--sp5);
}
.entrada__cartao {
  width: min(420px, 100%);
  background: var(--fundo1);
  border: 1px solid var(--linha);
  border-radius: var(--raio-lg);
  padding: var(--sp7) var(--sp6);
  box-shadow: var(--sombra3);
  text-align: center;
}
.entrada__marca { display: block; height: 40px; margin: 0 auto var(--sp3); }
.entrada__titulo { font-size: var(--t-h2); margin-bottom: var(--sp1); }
.entrada__sub { color: var(--texto2); font-size: var(--t-peq); margin-bottom: var(--sp6); }
.entrada__passos {
  display: flex; gap: var(--sp2); justify-content: center;
  margin-bottom: var(--sp6); font-size: var(--t-legenda); color: var(--texto3);
}
.entrada__passo { display: flex; align-items: center; gap: var(--sp1); }
.entrada__passo--ativo { color: var(--marca-viva); font-weight: 600; }
.entrada__passo--feito { color: var(--ok); }
.entrada__qr {
  background: var(--texto-invertido); padding: var(--sp3);
  border-radius: var(--raio-md); margin: 0 auto var(--sp4); width: 208px; height: 208px;
  display: grid; place-items: center;
}
.entrada__qr img, .entrada__qr svg { width: 100%; height: 100%; }
.entrada__segredo {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: var(--t-peq); color: var(--texto2); word-break: break-all;
  background: var(--fundo2); border-radius: var(--raio-sm); padding: var(--sp2); margin-bottom: var(--sp4);
}
.codigo-otp {
  width: 100%; text-align: center; letter-spacing: 10px;
  font-size: var(--t-display); font-family: var(--fonte-num); font-variant-numeric: tabular-nums;
}

/* ============================ SHELL ============================ */
.shell { display: grid; grid-template-columns: var(--lateral) 1fr; min-height: 100vh; }

.lateral {
  background: var(--fundo1);
  border-right: 1px solid var(--linha);
  padding: var(--sp4) var(--sp3);
  display: flex; flex-direction: column; gap: var(--sp1);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.lateral__marca { display: flex; align-items: center; gap: var(--sp2); padding: var(--sp2) var(--sp2) var(--sp5); }
.lateral__marca img { height: 26px; }
.lateral__grupo {
  font-size: var(--t-legenda); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--texto3); padding: var(--sp4) var(--sp2) var(--sp1);
}
.lateral__item {
  display: flex; align-items: center; gap: var(--sp3);
  padding: var(--sp2) var(--sp3); border-radius: var(--raio-md);
  color: var(--texto2); font-size: var(--t-peq); cursor: pointer; border: 0; background: none;
  width: 100%; text-align: left; font-family: inherit;
}
.lateral__item:hover { background: var(--fundo3); color: var(--texto1); }
.lateral__item--ativo { background: var(--marca-suave); color: var(--texto1); font-weight: 600; }
.lateral__item--ativo .lateral__ponto { background: var(--marca-viva); }
.lateral__ponto { width: 6px; height: 6px; border-radius: var(--raio-full); background: var(--texto3); flex: none; }
.lateral__contador {
  margin-left: auto; background: var(--erro); color: var(--texto-invertido);
  border-radius: var(--raio-full); font-size: 11px; padding: 1px 7px; font-weight: 700;
}
.lateral__rodape { margin-top: auto; padding-top: var(--sp4); border-top: 1px solid var(--linha); }
.lateral__usuario { font-size: var(--t-legenda); color: var(--texto3); padding: var(--sp2); }
.lateral__usuario strong { color: var(--texto2); display: block; font-size: var(--t-peq); }

.conteudo { padding: var(--sp6) var(--sp7); max-width: 1600px; }
.topo { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp4); margin-bottom: var(--sp6); }
.topo h1 { font-size: var(--t-h1); font-weight: 600; }
.topo p { color: var(--texto3); font-size: var(--t-peq); margin-top: 2px; }
.topo__acoes { display: flex; gap: var(--sp2); align-items: center; flex-wrap: wrap; }

/* ============================ COMPONENTES ============================ */
.cartao {
  background: var(--fundo1); border: 1px solid var(--linha);
  border-radius: var(--raio-md); padding: var(--sp5);
}
.cartao__titulo { font-size: var(--t-h2); font-weight: 600; margin-bottom: var(--sp4); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp3); margin-bottom: var(--sp5); }
.kpi { background: var(--fundo1); border: 1px solid var(--linha); border-radius: var(--raio-md); padding: var(--sp4); }
.kpi__rotulo { font-size: var(--t-legenda); color: var(--texto3); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi__valor { font-size: var(--t-display); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: var(--sp1); }
.kpi__nota { font-size: var(--t-legenda); color: var(--texto2); margin-top: var(--sp1); }
.kpi--ok .kpi__valor { color: var(--ok); }
.kpi--alerta .kpi__valor { color: var(--alerta); }
.kpi--erro .kpi__valor { color: var(--erro); }
.kpi--marca .kpi__valor { color: var(--marca-viva); }

.secao { margin-bottom: var(--sp6); }
.secao__titulo { font-size: var(--t-h2); font-weight: 600; margin-bottom: var(--sp3); display: flex; align-items: center; gap: var(--sp2); }
.grade2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--sp4); }

table { width: 100%; border-collapse: collapse; font-size: var(--t-peq); }
thead th {
  text-align: left; color: var(--texto3); font-weight: 600; font-size: var(--t-legenda);
  text-transform: uppercase; letter-spacing: 0.04em; padding: var(--sp2) var(--sp3);
  border-bottom: 1px solid var(--linha); white-space: nowrap;
}
tbody td { padding: var(--sp3); border-bottom: 1px solid var(--linha); vertical-align: middle; }
tbody tr:hover { background: var(--fundo2); }
tbody tr.clicavel { cursor: pointer; }
.tabela-rolagem { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-flex; align-items: center; gap: var(--sp1);
  padding: 2px var(--sp2); border-radius: var(--raio-full);
  font-size: var(--t-legenda); font-weight: 600; white-space: nowrap;
}
.tag--ok { background: var(--ok-fundo); color: var(--ok); }
.tag--alerta { background: var(--alerta-fundo); color: var(--alerta); }
.tag--erro { background: var(--erro-fundo); color: var(--erro); }
.tag--info { background: var(--info-fundo); color: var(--info); }
.tag--neutro { background: var(--fundo3); color: var(--texto2); }
.tag--carro { background: var(--fundo3); color: var(--carro); }
.tag--moto { background: var(--fundo3); color: var(--moto); }

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp2);
  padding: var(--sp2) var(--sp4); border-radius: var(--raio-md); border: 1px solid transparent;
  font-size: var(--t-peq); font-weight: 600; font-family: inherit; cursor: pointer;
  background: var(--marca); color: var(--texto-invertido); min-height: 38px;
}
.botao:hover { background: var(--marca-forte); }
.botao:disabled { opacity: 0.5; cursor: not-allowed; }
.botao--fantasma { background: transparent; border-color: var(--linha-forte); color: var(--texto2); }
.botao--fantasma:hover { background: var(--fundo3); color: var(--texto1); }
.botao--perigo { background: var(--erro); }
.botao--perigo:hover { background: var(--erro); filter: brightness(1.1); }
.botao--ok { background: var(--ok); color: var(--fundo0); }
.botao--peq { min-height: 30px; padding: var(--sp1) var(--sp3); font-size: var(--t-legenda); }

input, select, textarea {
  background: var(--fundo3); border: 1px solid var(--linha-forte); border-radius: var(--raio-md);
  color: var(--texto1); padding: var(--sp2) var(--sp3); font-family: inherit; font-size: var(--t-peq);
  min-height: 38px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marca-viva); outline-offset: -1px; }
label { display: block; font-size: var(--t-legenda); color: var(--texto2); margin-bottom: var(--sp1); }
.campo { margin-bottom: var(--sp3); }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp3); }
.filtros { display: flex; gap: var(--sp2); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--sp4); }
.filtros .campo { margin: 0; min-width: 150px; }

.vazio { text-align: center; padding: var(--sp8) var(--sp4); color: var(--texto3); }
.vazio strong { display: block; color: var(--texto2); margin-bottom: var(--sp1); font-size: var(--t-corpo); }

.carregando { color: var(--texto3); padding: var(--sp6); text-align: center; font-size: var(--t-peq); }

.aviso {
  padding: var(--sp3) var(--sp4); border-radius: var(--raio-md);
  font-size: var(--t-peq); margin-bottom: var(--sp4); border: 1px solid transparent;
}
.aviso--erro { background: var(--erro-fundo); color: var(--erro); border-color: var(--erro); }
.aviso--alerta { background: var(--alerta-fundo); color: var(--alerta); }
.aviso--info { background: var(--info-fundo); color: var(--info); }
.aviso--ok { background: var(--ok-fundo); color: var(--ok); }

/* modal */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
  display: grid; place-items: center; padding: var(--sp5); z-index: 50;
}
.modal {
  background: var(--fundo1); border: 1px solid var(--linha); border-radius: var(--raio-lg);
  width: min(760px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--sombra3);
}
.modal__topo {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp4) var(--sp5); border-bottom: 1px solid var(--linha);
  position: sticky; top: 0; background: var(--fundo1);
}
.modal__titulo { font-size: var(--t-h2); font-weight: 600; }
.modal__corpo { padding: var(--sp5); }
.modal__rodape {
  padding: var(--sp4) var(--sp5); border-top: 1px solid var(--linha);
  display: flex; gap: var(--sp2); justify-content: flex-end;
  position: sticky; bottom: 0; background: var(--fundo1);
}
.fechar { background: none; border: 0; color: var(--texto3); font-size: 22px; cursor: pointer; line-height: 1; }
.fechar:hover { color: var(--texto1); }

/* toast */
.toasts { position: fixed; right: var(--sp5); bottom: var(--sp5); display: flex; flex-direction: column; gap: var(--sp2); z-index: 60; }
.toast {
  background: var(--fundo2); border: 1px solid var(--linha-forte); border-left: 3px solid var(--marca-viva);
  border-radius: var(--raio-md); padding: var(--sp3) var(--sp4); font-size: var(--t-peq);
  box-shadow: var(--sombra2); max-width: 380px;
}
.toast--ok { border-left-color: var(--ok); }
.toast--erro { border-left-color: var(--erro); }

/* listas de detalhe */
.dados { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp3) var(--sp5); }
.dado__rotulo { font-size: var(--t-legenda); color: var(--texto3); }
.dado__valor { font-size: var(--t-peq); color: var(--texto1); }

.documento {
  display: flex; align-items: center; gap: var(--sp3); padding: var(--sp3);
  border: 1px solid var(--linha); border-radius: var(--raio-md); margin-bottom: var(--sp2);
}
.documento__info { flex: 1; min-width: 0; }
.documento__nome { font-size: var(--t-peq); font-weight: 600; }
.documento__ajuda { font-size: var(--t-legenda); color: var(--texto3); }
.documento__acoes { display: flex; gap: var(--sp2); flex: none; }

/* gráfico de barras simples (sem biblioteca) */
.grafico { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: var(--sp3); }
.grafico__barra { flex: 1; background: var(--marca); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.grafico__barra:hover { background: var(--marca-viva); }
.grafico__legenda { display: flex; justify-content: space-between; font-size: var(--t-legenda); color: var(--texto3); margin-top: var(--sp2); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .lateral__grupo, .lateral__rodape { display: none; }
  .conteudo { padding: var(--sp4); }
}
