:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #dfe5eb;
  --brand: #0f5c63;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1f1;
  --ok: #1f7a46;
  --ok-soft: #e4f4ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --err: #a3242a;
  --err-soft: #fbe6e7;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
small, .muted { color: var(--muted); }

.topo {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem;
}
.topo .marca { font-weight: 700; color: inherit; text-decoration: none; }
.topo .amb { margin-left: auto; font-size: .75rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; }
.amb.homologacao { background: #ffcf5a; color: #4a3500; }
.amb.producao { background: #b9f0cf; color: #0d4d2a; }
.faixa-homolog { background: #ffcf5a; color: #4a3500; text-align: center; font-size: .85rem; padding: .35rem; }

nav.menu {
  display: flex; overflow-x: auto; gap: .25rem; padding: .4rem .5rem;
  background: var(--card); border-bottom: 1px solid var(--line);
}
nav.menu a {
  white-space: nowrap; text-decoration: none; color: var(--ink);
  padding: .45rem .75rem; border-radius: 999px; font-size: .95rem;
}
nav.menu a.ativo { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.grade { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi .valor { font-size: 1.5rem; font-weight: 700; }
.kpi .rotulo { color: var(--muted); font-size: .85rem; }

.flash { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cc; }
.flash.aviso { background: var(--warn-soft); color: var(--warn); border-color: #f0dca6; }
.flash.erro { background: var(--err-soft); color: var(--err); border-color: #efc2c5; }
.flash ul { margin: .25rem 0 0; padding-left: 1.2rem; }

label { display: block; font-weight: 600; font-size: .92rem; margin: .8rem 0 .3rem; }
label .dica { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=email], input[type=tel], input[type=number], input[type=month], select, textarea {
  width: 100%; font: inherit; padding: .7rem .75rem; border: 1px solid #c8d1da; border-radius: 10px; background: #fff;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: .8rem 0; }
.check input { margin-top: .25rem; width: 1.15rem; height: 1.15rem; }
.linha { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .linha { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; padding: .75rem 1.1rem; border-radius: 10px;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  text-decoration: none; cursor: pointer;
}
.btn.sec { background: #fff; color: var(--brand); }
.btn.perigo { background: #fff; color: var(--err); border-color: var(--err); }
.btn.grande { width: 100%; padding: 1rem; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.acoes form { display: inline; margin: 0; }

.atalhos { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.atalhos a { text-align: center; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li { border-bottom: 1px solid var(--line); }
.lista li:last-child { border-bottom: 0; }
.lista a.item { display: flex; gap: .75rem; align-items: center; padding: .75rem .25rem; text-decoration: none; color: inherit; }
.item .principal { flex: 1; min-width: 0; }
.item .titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--muted); font-size: .85rem; }
.item .direita { text-align: right; white-space: nowrap; }

.selo { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: #eef1f4; color: var(--muted); }
.selo.autorizada { background: var(--ok-soft); color: var(--ok); }
.selo.cancelada { background: #eceff3; color: #49535e; text-decoration: line-through; }
.selo.rejeitada, .selo.erro_validacao { background: var(--err-soft); color: var(--err); }
.selo.pendente { background: var(--warn-soft); color: var(--warn); }
.selo.rascunho { background: var(--brand-soft); color: var(--brand); }

dl.dados { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.dados dt { color: var(--muted); }
dl.dados dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.dados { grid-template-columns: 1fr; } dl.dados dd { margin-bottom: .4rem; } }

.chave { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filtros > * { flex: 1 1 140px; }
.sugestoes { border: 1px solid var(--line); border-radius: 10px; margin-top: .25rem; background: #fff; overflow: hidden; }
.sugestoes button { display: block; width: 100%; text-align: left; padding: .6rem .75rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; }
.sugestoes button:last-child { border-bottom: 0; }
.oculto { display: none !important; }
details summary { cursor: pointer; font-weight: 600; margin: .8rem 0; color: var(--brand); }
.rodape { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2.5rem; }
pre.xml { white-space: pre-wrap; font-size: .8rem; background: #f7f9fb; padding: .75rem; border-radius: 8px; max-height: 300px; overflow: auto; }
