:root {
  --ink: #141c16;
  --deep: #1c2e22;
  --leaf: #2f4a38;
  --cream: #f3eee4;
  --paper: #fffbf4;
  --copper: #c56a32;
  --copper-d: #9a4e22;
  --line: #d8cfc0;
  --mute: #6b6258;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Outfit, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #3a5a44 0%, transparent 50%),
    var(--cream);
  color: var(--ink);
}
h1, h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  margin: 0;
}
.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--copper);
  margin: 0 0 0.35rem;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--deep);
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  padding: 2.4rem 2.1rem;
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
}
.login-card .lead { color: var(--mute); line-height: 1.5; }
.login-card label, .painel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  margin-top: 1rem;
}
input, select, button {
  font: inherit;
  border-radius: 12px;
}
input, select {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.75rem 0.9rem;
}
.login-card button, .regimes button {
  border: 0;
  background: var(--copper);
  color: #fff;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
}
.login-card button { width: 100%; margin-top: 1.2rem; }
.login-card button:hover { background: var(--copper-d); }
.erro { color: #9b2c2c; font-size: 0.9rem; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 1.6rem 2rem 0.4rem;
}
.who { display: flex; gap: 1rem; align-items: center; color: var(--mute); flex-wrap: wrap; justify-content: flex-end; }
.who a { color: var(--copper-d); }
.cliente-tag { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--mute); }
.acesso-chip {
  font-size: 0.78rem;
  color: var(--mute);
}
.acesso-chip.acesso-alerta {
  color: var(--copper-d);
  font-weight: 600;
}
.nav-admin { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.nav-admin a { font-weight: 600; text-decoration: none; }
.licenca-bar {
  margin: 0.4rem 2rem 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--copper-d);
}
.login-foot { margin: 1.2rem 0 0; font-size: 0.78rem; color: var(--mute); line-height: 1.4; }

.painel {
  margin: 1rem 2rem 0;
  padding: 1.4rem;
  background: var(--paper);
  border-radius: 24px;
  border: 1px solid var(--line);
  display: grid;
  gap: 1rem;
}
.drop {
  display: grid;
  gap: 0.25rem;
  padding: 1.2rem;
  border: 1.5px dashed #cbbca6;
  border-radius: 18px;
  background: #faf6ee;
  cursor: pointer;
}
.drop strong { font-size: 1.05rem; }
.drop span, .drop em { color: var(--mute); font-style: normal; font-size: 0.9rem; }
.drop.over { border-color: var(--copper); background: #fff4ea; }

.regimes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.regimes button {
  background: #efe8dc;
  color: var(--ink);
}
.regimes.travado button { cursor: default; opacity: 0.85; }
.regimes.travado button:not(.ativo) { pointer-events: none; }
.sn { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.margem { max-width: 280px; }
.busca { display: flex; flex-direction: column; gap: 0.35rem; max-width: 420px; margin: 0 0 1rem; font-size: 0.86rem; }
.preco-edit {
  width: 8.2rem;
  text-align: right;
  font-family: Fraunces, serif;
  font-size: 1.1rem;
  color: var(--copper-d);
  padding: 0.35rem 0.45rem;
}
.extras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem 1rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--line);
}
.extras .mem { grid-column: 1 / -1; }
.btn-mini {
  margin-top: 0.45rem;
  border: 0;
  background: var(--leaf);
  color: #fff;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  width: fit-content;
}
.btn-mini:hover { background: var(--deep); }
.esconde { display: none !important; }

.nota, .ibs-faixa, .tabela-wrap {
  margin: 1rem 2rem;
  padding: 1.2rem 1.4rem;
  background: var(--paper);
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow-x: auto;
}
.aviso-sim { margin: 1.2rem 0 0; color: #9a4e22; }
.nota { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; }
.nota b, .empresa-faixa b { display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.empresa-faixa {
  margin: 1rem 2rem 0;
  padding: 1.1rem 1.4rem;
  background: #1d3a5c;
  color: #f4efe4;
  border-radius: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.6rem;
}
.empresa-faixa b { color: #9db7d4; }
.empresa-faixa .mem { color: #c9d6e4; }
.ibs-faixa {
  background: var(--deep);
  color: #efe8dc;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.ibs-faixa small { color: #c9c0b0; }
.alertas {
  margin: 1rem 2rem 0;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid #e2b8a0;
  background: #fff4ea;
}
.alertas h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.alertas li { margin: 0.3rem 0; }
.alertas .erro { color: #9b2c2c; font-weight: 600; }
.aviso-rbt { color: #9a4e22; font-size: 0.82rem; margin: 0.4rem 0 0; }
.busca-hist { display: flex; flex-direction: column; gap: 0.35rem; max-width: 420px; margin: 0 0 0.9rem; font-size: 0.86rem; }
.drop-mini { margin-top: 0.4rem; cursor: pointer; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); padding: 0.5rem 0.4rem; }
td { padding: 0.7rem 0.4rem; border-top: 1px solid var(--line); vertical-align: top; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.preco { font-family: Fraunces, serif; font-size: 1.25rem; color: var(--copper-d); }
.mem { font-size: 0.8rem; color: var(--mute); margin: 0.15rem 0 0; }
.cenarios { margin-top: 1.6rem; }
.cenarios h2 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.cenarios-tbl { margin-top: 0.8rem; }
.cenarios-tbl thead th {
  background: #1d3a5c;
  color: #fff;
  padding: 0.7rem 0.6rem;
  letter-spacing: 0.04em;
}
.cenarios-tbl tbody tr:nth-child(even) { background: #eef4fb; }
.cenarios-tbl tbody tr:nth-child(odd) { background: #fff; }
.cenarios-tbl td { border-top: 1px solid #d5e0ec; }
.cenarios-tbl tr.destaque td { font-weight: 600; }
tr.alerta-linha td { background: #fff1e8; }
.rodape-tec {
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  background: #f4f7fb;
  border-radius: 14px;
  border-left: 4px solid #1d3a5c;
}
.rodape-tec h3 { font-size: 0.95rem; margin: 0 0 0.6rem; }
.rodape-tec ul { margin: 0; padding-left: 1.1rem; }
.rodape-tec li { margin: 0.45rem 0; color: #3a4450; line-height: 1.45; font-size: 0.88rem; }

.acoes-admin { margin: 0 2rem 1.6rem; display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: stretch; }
.acoes-admin button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  background: var(--deep);
  color: #f4efe4;
  border: 0;
  padding: 0.95rem 1.35rem;
  cursor: pointer;
}
.acoes-admin button:hover { background: #142018; }
.acoes-admin button small { font-weight: 400; color: #c9c0b0; }
.acoes-admin .drop-mini { flex: 1 1 280px; margin: 0; }

.filtros-dias { display: flex; gap: 0.5rem; margin: 0 0 1rem; }
.filtros-dias button {
  border: 1px solid var(--line);
  background: #efe8dc;
  color: var(--ink);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
.filtros-dias button.ativo { background: var(--deep); color: #f4efe4; border-color: var(--deep); }
.cards-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin: 0 0 1.2rem;
}
.cards-kpi article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
}
.cards-kpi b {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.cards-kpi strong {
  display: block;
  margin-top: 0.35rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
}
#grafico-margem { width: 100%; max-width: 920px; height: auto; }

@media (max-width: 800px) {
  .regimes, .sn { grid-template-columns: 1fr; }
  .top, .painel, .nota, .ibs-faixa, .tabela-wrap, .empresa-faixa, .acoes-admin, .licenca-bar, .alertas { margin-left: 1rem; margin-right: 1rem; }
}
