@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fontes/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fontes/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fontes/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fontes/inter-700.woff2") format("woff2");
}

:root, [data-tema="claro"] {
  color-scheme: light;
  --fundo: #eef1f6;
  --fundo-2: #f7f8fb;
  --superficie: #ffffff;
  --superficie-2: #f1f4f9;
  --linha: #d7deea;
  --texto: #1c2434;
  --muted: #5f6b7f;
  --acento: #3d4fd8;
  --acento-2: #3141b8;
  --acento-suave: #e8ebfb;
  --ok: #0f7a58;
  --ok-fundo: #e7f7f0;
  --alerta: #9a6700;
  --alerta-fundo: #fff6df;
  --erro: #b42318;
  --erro-fundo: #fdecec;
  --sombra: 0 10px 30px rgba(28, 36, 52, 0.06);
  --sombra-forte: 0 18px 40px rgba(28, 36, 52, 0.1);
  --raio: 14px;
  --nav: 260px;
  --max: 1120px;
}

[data-tema="escuro"] {
  color-scheme: dark;
  --fundo: #0f141f;
  --fundo-2: #151c2a;
  --superficie: #1a2333;
  --superficie-2: #232e42;
  --linha: #2d3a52;
  --texto: #eef2f8;
  --muted: #9aa8c0;
  --acento: #8b9cff;
  --acento-2: #6f82f0;
  --acento-suave: #243056;
  --ok: #3dd6a5;
  --ok-fundo: #16352c;
  --alerta: #f5c16c;
  --alerta-fundo: #3a3018;
  --erro: #ff8b8b;
  --erro-fundo: #3a1d22;
  --sombra: 0 12px 32px rgba(0, 0, 0, 0.28);
  --sombra-forte: 0 20px 48px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
body {
  min-height: 100dvh;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--texto);
  background:
    radial-gradient(720px 320px at 12% -8%, rgba(61, 79, 216, 0.08), transparent 60%),
    radial-gradient(640px 280px at 100% 0%, rgba(15, 122, 88, 0.05), transparent 55%),
    var(--fundo);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acento); }
img, svg { max-width: 100%; display: block; }

.pular {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  background: var(--acento);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  z-index: 20;
}
.pular:focus { top: 0.5rem; }

.login-pagina {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.login-card {
  width: min(100%, 420px);
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: 22px;
  box-shadow: var(--sombra-forte);
  padding: 1.6rem 1.5rem 1.4rem;
}
.login-card .btn { width: 100%; }
.login-card .campo-senha .btn { width: auto; }

.marca { display: flex; align-items: center; gap: 0.75rem; }
.marca strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.marca .muted, .muted, .ajuda { color: var(--muted); }
.ajuda { display: block; margin: 0.25rem 0 0; font-size: 0.78rem; font-weight: 400; line-height: 1.4; }

.cabecalho-pagina {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem 1rem;
  margin: 0 0 1.1rem;
}
.cabecalho-pagina h1 { margin: 0; }
.cabecalho-pagina .muted { margin: 0.25rem 0 0; max-width: 42rem; }

h1, h2, h3 { margin: 0 0 0.4rem; letter-spacing: -0.025em; font-weight: 700; color: var(--texto); }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }

.campo { display: grid; gap: 0.35rem; margin: 0; }
.campo label {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--texto);
}
.grade-campos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}
.grade-campos .campo.largo { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--linha);
  background: var(--fundo-2);
  padding: 0.7rem 0.85rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: #8a95a8; }
textarea { min-height: 104px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b7c2d6; }
input:focus, select:focus, textarea:focus {
  background: var(--superficie);
  border-color: var(--acento);
  box-shadow: 0 0 0 3px var(--acento-suave);
  outline: none;
}
button:focus-visible, a:focus-visible, .nav button.item:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

.campo-senha { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; align-items: stretch; }
.campo-moeda {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--linha);
  border-radius: 12px;
  background: var(--fundo-2);
  overflow: hidden;
}
.campo-moeda .prefixo {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  color: var(--muted);
  font-weight: 650;
  background: var(--superficie-2);
  border-right: 1px solid var(--linha);
}
.campo-moeda input {
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 46px;
  box-shadow: none;
}
.campo-moeda:focus-within {
  border-color: var(--acento);
  box-shadow: 0 0 0 3px var(--acento-suave);
}
.campo-erro[hidden] { display: none; }
.campo-erro { margin: 0; min-height: 0; font-size: 0.8rem; }

.btn, button.btn {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  background: var(--acento);
  color: #fff;
  font-weight: 650;
  box-shadow: none;
}
.btn:hover { background: var(--acento-2); }
.btn.secundario, button.secundario {
  background: var(--superficie);
  color: var(--texto);
  border: 1px solid var(--linha);
}
.btn.secundario:hover, button.secundario:hover { background: var(--superficie-2); }
.btn.perigo, button.perigo { background: var(--erro); color: #fff; }
.btn.fantasma, button.fantasma {
  background: transparent;
  color: var(--texto);
  border: 1px solid var(--linha);
}
.btn.fantasma:hover, button.fantasma:hover { background: var(--superficie-2); }
.btn:disabled { opacity: 0.65; cursor: progress; }

.linha-acoes, .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.35rem;
}
.erro { color: var(--erro); min-height: 1.2rem; margin: 0.5rem 0 0; }
.ok { color: var(--ok); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--superficie-2);
  border: 1px solid var(--linha);
  font-size: 0.75rem;
  font-weight: 650;
}
.badge.ok { color: var(--ok); background: var(--ok-fundo); border-color: transparent; }
.badge.alerta { color: var(--alerta); background: var(--alerta-fundo); border-color: transparent; }
.badge.erro { color: var(--erro); background: var(--erro-fundo); border-color: transparent; }

.app {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr);
  min-height: 100dvh;
}
.nav {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 1.1rem 0.85rem;
  background: var(--superficie);
  border-right: 1px solid var(--linha);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav .marca { padding: 0.35rem 0.55rem 1rem; }
.nav .secao {
  margin: 0.55rem 0.55rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav button.item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 44px;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--texto);
  padding: 0.45rem 0.7rem;
  font-weight: 550;
}
.nav button.item:hover { background: var(--superficie-2); }
.nav button.item[aria-current="page"] {
  background: var(--acento-suave);
  color: var(--acento-2);
  font-weight: 700;
}
.nav .rodape {
  margin-top: auto;
  display: grid;
  gap: 0.55rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--linha);
}
.nav .operador {
  padding: 0 0.55rem;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.topo {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--linha);
  background: var(--superficie);
  position: sticky;
  top: 0;
  z-index: 5;
}

.conteudo {
  min-width: 0;
  padding: 1.35rem 1.4rem 2rem;
}
.conteudo > * { max-width: var(--max); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}
.card, .cards button.card {
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 1rem 1.05rem;
  text-align: left;
  box-shadow: var(--sombra);
  color: var(--texto);
  min-height: 96px;
}
.cards button.card:hover {
  border-color: #b8c3db;
  box-shadow: var(--sombra-forte);
}
.cards .card > .muted,
.cards .card > strong,
.cards button.card strong { display: block; }
.cards button.card strong,
.cards .card > strong {
  margin-top: 0.35rem;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.painel {
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 1.15rem 1.2rem;
  margin-bottom: 1rem;
}
.painel > h2:first-child { margin-top: 0; }
.painel + .painel { margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.85rem; }
.chips button {
  min-height: 40px;
  white-space: nowrap;
  border-radius: 999px;
  padding-inline: 0.9rem;
}
.chips button[aria-pressed="true"] {
  background: var(--acento);
  color: white;
  border-color: transparent;
}

.tabela-envolve {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  background: var(--superficie);
  box-shadow: var(--sombra);
}
.tabela { width: 100%; border-collapse: collapse; min-width: 640px; }
.tabela th, .tabela td {
  text-align: left;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--linha);
  vertical-align: top;
}
.tabela th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--superficie-2);
}
.tabela tr:last-child td { border-bottom: 0; }

.vazio, .skeleton {
  border: 1px dashed var(--linha);
  border-radius: var(--raio);
  padding: 1.5rem;
  color: var(--muted);
  background: var(--superficie);
}
.skeleton {
  background: linear-gradient(90deg, var(--superficie), var(--superficie-2), var(--superficie));
  background-size: 200% 100%;
}

.abas {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 1rem;
  padding: 0.25rem;
  background: var(--superficie-2);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}
.abas button {
  border: 0;
  background: transparent;
  min-height: 40px;
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.abas button[aria-selected="true"] {
  background: var(--superficie);
  color: var(--texto);
  box-shadow: var(--sombra);
}

.modal-fundo {
  position: fixed;
  inset: 0;
  background: rgba(28, 36, 52, 0.42);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 30;
}
.modal {
  width: min(100%, 560px);
  max-height: min(92dvh, 820px);
  overflow: auto;
  background: var(--superficie);
  border-radius: 20px;
  border: 1px solid var(--linha);
  box-shadow: var(--sombra-forte);
  padding: 1.2rem;
}
.modal h2 { margin-bottom: 0.8rem; }

#toasts {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  display: grid;
  gap: 0.45rem;
  z-index: 40;
}
.toast {
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  box-shadow: var(--sombra-forte);
}

.grafico { width: 100%; height: 168px; }
.switch {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  font-size: 0.88rem;
}
.segredo {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  background: var(--fundo-2);
  border: 1px solid var(--linha);
  border-radius: 12px;
  padding: 0.75rem;
}
.qrcode {
  margin: 0.9rem 0;
  padding: 0.9rem;
  text-align: center;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--linha);
}
.qrcode img { margin: 0 auto; width: 220px; height: 220px; }
.qrcode figcaption { margin-top: 0.45rem; color: #5f6b7f; }
.segredo-manual { margin: 0.8rem 0; }
.segredo-manual summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted);
}

.filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.filtros[hidden] { display: none; }
.paginacao {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.9rem;
}
.check { width: 1.15rem; height: 1.15rem; accent-color: var(--acento); }

.lista-atencao { display: grid; gap: 0.7rem; }
.lista-atencao ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .topo { display: flex; }
  .nav {
    position: fixed;
    z-index: 25;
    transform: translateX(-105%);
    width: min(88vw, 320px);
    transition: transform 0.2s ease;
    box-shadow: var(--sombra-forte);
  }
  .nav.aberto { transform: none; }
  .cortina { position: fixed; inset: 0; background: rgba(28, 36, 52, 0.4); z-index: 24; }
  .conteudo { padding: 1rem; }
  .grade-campos { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .modal-fundo { padding: 0; align-items: stretch; }
  .modal { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .tabela { min-width: 0; }
  .tabela thead { display: none; }
  .tabela, .tabela tbody, .tabela tr, .tabela td { display: block; width: 100%; }
  .tabela-envolve { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .tabela tr {
    border: 1px solid var(--linha);
    border-radius: 14px;
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.8rem;
    background: var(--superficie);
    box-shadow: var(--sombra);
  }
  .tabela td {
    border: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem 0.8rem;
    padding: 0.45rem 0;
  }
  .tabela td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: auto;
  }
  .tabela td .muted {
    flex-basis: 100%;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .abas { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
