:root {
  --escuro: #0e0e0e; --claro: #ededed; --azul: #2563eb; --azul-escuro: #1d4ed8; --azul-fraco: #e8effd;
  --fundo: #f5f6f8; --cartao: #fff; --texto: #14171f; --fraco: #5f6775; --borda: #e2e5ea;
  --verde: #147a45; --verde-f: #e4f5ec; --amarelo: #8a6100; --amarelo-f: #fdf1d3; --laranja: #b04a00; --laranja-f: #fde8da;
  --vermelho: #b42318; --vermelho-f: #fde8e6; --cinza-f: #eceef1;
}
* { box-sizing: border-box; }
html { font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 15px; }
body { margin: 0; background: var(--fundo); color: var(--texto); line-height: 1.45; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .7rem; display: flex; gap: .5rem; align-items: center; }
h3 { font-size: .95rem; margin: 0 0 .4rem; }
p { margin: .3rem 0; }
a { color: var(--azul); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }

input, select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--borda); border-radius: 8px; background: #fff; color: var(--texto); min-width: 0; max-width: 100%; }
input.curto { width: 6.5rem; }
.botao { font: inherit; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--borda); background: #fff; color: var(--texto); cursor: pointer; text-decoration: none; white-space: nowrap; }
.botao:hover { border-color: #b9bec8; }
.botao:disabled { opacity: .5; cursor: default; }
.botao.principal { background: var(--azul); border-color: var(--azul); color: #fff; }
.botao.principal:hover { background: var(--azul-escuro); }
.botao.perigo { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.botao.grande { justify-content: center; padding: .7rem; width: 100%; }
.ligacao { font: inherit; background: none; border: 0; padding: 0; color: var(--azul); cursor: pointer; text-align: left; }

/* entrada */
.entrada { min-height: 100vh; background: var(--escuro); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem 1rem; }
.logo-grande { width: min(520px, 100%); height: auto; }
.cartao-entrada { background: #fff; border-radius: 16px; padding: 1.6rem; width: min(380px, 100%); display: flex; flex-direction: column; gap: .8rem; }
.erro-form { color: var(--vermelho); margin: 0; min-height: 1.2em; }

/* estrutura */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.lateral { background: var(--escuro); color: var(--claro); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: .9rem .7rem; }
.marca { display: flex; align-items: center; justify-content: space-between; }
.marca img { width: 150px; height: auto; }
.abrir-menu { display: none; background: none; color: var(--claro); border: 0; font-size: 1.5rem; cursor: pointer; }
.menu { display: flex; flex-direction: column; gap: 2px; margin-top: 1rem; flex: 1; overflow-y: auto; }
.menu a { color: #b9bec8; text-decoration: none; padding: .55rem .7rem; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.menu a:hover { background: #1b1d22; color: #fff; }
.menu a.ativo { background: var(--azul); color: #fff; }
.rodape-menu { border-top: 1px solid #26282e; padding: .7rem .5rem 0; font-size: .85rem; }
.rodape-menu small { color: #8d94a1; }
.corpo { min-width: 0; }
.topo { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: flex-end; padding: .6rem 1.4rem; background: #fff; border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; }
.estado { margin-right: auto; display: flex; align-items: center; gap: .5rem; color: var(--fraco); }
.bola { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #9aa1ad; flex: none; }
.bola.verde { background: #18a05a; } .bola.amarelo { background: #e0a100; } .bola.vermelho { background: #d92d20; }
.modo { background: var(--azul-fraco); color: var(--azul-escuro); padding: .25rem .7rem; border-radius: 999px; font-size: .85rem; }
body.parado .topo { border-bottom: 4px solid var(--vermelho); }
#conteudo { padding: 1.3rem 1.4rem 3rem; max-width: 1500px; }
#conteudo > div { display: flex; flex-direction: column; gap: 1rem; }

/* blocos */
.titulo { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .7rem; }
.linha { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.linha.fim { justify-content: flex-end; }
.linha.entre { justify-content: space-between; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: 14px; padding: 1rem 1.1rem; min-width: 0; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: .8rem; }
.grade.dois { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.numero-cartao { text-decoration: none; color: var(--texto); border-top: 4px solid var(--borda); display: flex; flex-direction: column; }
.numero-cartao strong { font-size: 2rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.numero-cartao span { color: var(--fraco); }
.numero-cartao:hover { border-color: var(--azul); }
.numero-cartao.vermelho { border-top-color: #d92d20; } .numero-cartao.laranja { border-top-color: #e8650d; }
.numero-cartao.amarelo { border-top-color: #e0a100; } .numero-cartao.verde { border-top-color: #18a05a; }
.numero-cartao.cinza { border-top-color: #9aa1ad; } .numero-cartao.azul { border-top-color: var(--azul); }
.destaque { font-size: 1.8rem; font-weight: 700; margin-top: .5rem; font-variant-numeric: tabular-nums; }
.nota { color: var(--fraco); font-size: .88rem; }
.bloco { display: block; }
.vermelho-texto { color: var(--vermelho); } .laranja-texto { color: var(--laranja); }
.etiqueta { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: var(--cinza-f); color: var(--fraco); }
.etiqueta.verde { background: var(--verde-f); color: var(--verde); } .etiqueta.amarelo { background: var(--amarelo-f); color: var(--amarelo); }
.etiqueta.laranja { background: var(--laranja-f); color: var(--laranja); } .etiqueta.vermelho { background: var(--vermelho-f); color: var(--vermelho); }
.etiqueta.azul { background: var(--azul-fraco); color: var(--azul-escuro); }
.selo { background: var(--azul); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .78rem; }
.faixa-aviso { background: var(--azul-fraco); border: 1px solid #c9d8fb; border-radius: 10px; padding: .7rem .9rem; }
.faixa-aviso.vermelha { background: var(--vermelho-f); border-color: #f5c2bd; color: var(--vermelho); font-weight: 600; }
.vazio, .carregando { color: var(--fraco); text-align: center; padding: 2rem 1rem; }
.abas { display: flex; gap: .4rem; flex-wrap: wrap; }
.abas a { padding: .4rem .9rem; border-radius: 999px; text-decoration: none; color: var(--fraco); border: 1px solid var(--borda); background: #fff; }
.abas a.ativo { background: var(--escuro); color: #fff; border-color: var(--escuro); }

/* tabelas */
.rolagem { overflow-x: auto; background: #fff; border: 1px solid var(--borda); border-radius: 12px; }
.cartao .rolagem { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--fraco); font-weight: 600; }
th, td { padding: .55rem .6rem; border-bottom: 1px solid var(--borda); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover, tr.sugerida { background: #f3f7ff; }
td small, li small { color: var(--fraco); }
td.anuncio { display: flex; gap: .6rem; align-items: center; min-width: 280px; max-width: 420px; }
td.anuncio img, .sem-foto { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--cinza-f); flex: none; }
td.anuncio div { min-width: 0; }
td.anuncio .nome { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texto); font-weight: 600; }
td.anuncio small { display: block; overflow-wrap: anywhere; }
td.acao { min-width: 220px; max-width: 340px; }
.paginacao { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.paginacao span { margin-right: auto; color: var(--fraco); }
.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.lista-simples li:last-child { border-bottom: 0; }

/* formulários */
.campo { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.campo > span { font-size: .85rem; font-weight: 600; }
.campo small { color: var(--fraco); font-size: .78rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; margin-bottom: .6rem; }
.marcar { display: flex; gap: .45rem; align-items: center; padding: .15rem 0; }
.marcas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: .6rem 0; }
.menu-colunas { position: relative; }
.menu-colunas summary { list-style: none; }
.menu-colunas > div { position: absolute; right: 0; top: 110%; z-index: 6; width: 220px; box-shadow: 0 12px 30px rgb(0 0 0 / .15); }
.recolhido summary { cursor: pointer; font-weight: 600; }
.recolhido form { margin-top: .6rem; }

.chave { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; flex: none; }
.chave input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chave span { position: absolute; inset: 0; background: #cfd3da; border-radius: 999px; transition: background .15s; pointer-events: none; }
.chave span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.chave input:checked + span { background: var(--azul); }
.chave input:checked + span::after { transform: translateX(18px); }
.chave input:focus-visible + span { outline: 3px solid var(--azul); outline-offset: 2px; }
.chave input:disabled + span { opacity: .5; }

/* gaveta, janela e avisos */
.gaveta-fundo { position: fixed; inset: 0; background: rgb(10 12 18 / .4); z-index: 20; display: flex; justify-content: flex-end; }
.gaveta { background: #fff; width: min(640px, 100%); height: 100%; overflow-y: auto; padding: 1.1rem 1.3rem 3rem; display: flex; flex-direction: column; gap: .7rem; }
.gaveta section { border-top: 1px solid var(--borda); padding-top: .8rem; }
.parcela { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--borda); }
.parcela b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.parcela small { color: var(--fraco); }
.parcela.total { border-bottom: 0; background: var(--azul-fraco); border-radius: 8px; padding: .6rem; margin-top: .3rem; }
.janela { border: 0; border-radius: 14px; padding: 1.3rem; width: min(440px, 92vw); box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
.janela::backdrop { background: rgb(10 12 18 / .45); }
.janela-texto { margin-bottom: 1rem; color: var(--fraco); }
#avisos { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, 92vw); }
.aviso { background: var(--escuro); color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.aviso.erro { background: var(--vermelho); }

@media (max-width: 820px) {
  .app { display: block; }
  .lateral { position: sticky; z-index: 10; height: auto; max-height: 100vh; padding: .6rem .8rem; }
  .abrir-menu { display: block; }
  .lateral .menu, .lateral .rodape-menu { display: none; }
  .lateral.aberta .menu, .lateral.aberta .rodape-menu { display: flex; flex-direction: column; }
  .topo { position: static; padding: .6rem .8rem; }
  #conteudo { padding: 1rem .8rem 3rem; }
  .grade.dois { grid-template-columns: minmax(0, 1fr); }
  .filtros > * { flex: 1 1 140px; }
}
