/* tokens.css — identidade visual do Raiz e Folha.
   O bloco abaixo é cópia literal de empresa.html:8-22. Valores intactos:
   não trocar pelas cores da logo do Instagram nem "ajustar" tom. */

:root {
  --leaf: #2f7d4a;
  --leaf-dark: #173f2b;
  --mint: #edf7ef;
  --earth: #8a5d3b;
  --tomato: #d94b3d;
  --sun: #f0b640;
  --blue: #315d8c;
  --ink: #1d2a22;
  --muted: #66756a;
  --line: #dce6dc;
  --paper: #fbfaf4;
  --white: #ffffff;
  --shadow: 0 18px 44px rgba(29, 42, 34, 0.1);
}

/* Acréscimos do app (não alteram nenhum valor acima). */
:root {
  --raio: 14px;
  --raio-sm: 10px;
  --toque: 48px; /* alvo mínimo de toque no celular */
  --fonte: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --abaixo-do-alvo: var(--leaf); /* comprou bem */
  --acima-do-alvo: var(--tomato); /* comprou caro */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--fonte);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ————— controles ————— */

.campo {
  display: grid;
  gap: 6px;
}

.campo > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.campo input,
.campo select {
  min-height: var(--toque);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--raio-sm);
  background: var(--white);
  width: 100%;
}

.campo input:focus-visible,
.campo select:focus-visible,
.botao:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--leaf) 45%, transparent);
  outline-offset: 2px;
}

.campo input[aria-invalid='true'] {
  border-color: var(--tomato);
}

.botao {
  min-height: var(--toque);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--raio-sm);
  background: var(--leaf);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.botao:disabled {
  opacity: 0.55;
  cursor: progress;
}

.botao.secundario {
  background: var(--white);
  color: var(--leaf-dark);
  border-color: var(--line);
}

/* ————— blocos ————— */

.cartao {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--raio);
  box-shadow: var(--shadow);
}

.aviso {
  padding: 12px 14px;
  border-radius: var(--raio-sm);
  background: color-mix(in srgb, var(--tomato) 12%, var(--white));
  border: 1px solid color-mix(in srgb, var(--tomato) 35%, var(--line));
  color: var(--tomato);
  font-size: 0.9rem;
  font-weight: 600;
}

.marca {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--leaf);
  color: var(--white);
  font-weight: 800;
  letter-spacing: 0.06em;
}

/* ————— navegação ————— */

.barra {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--leaf-dark);
  color: var(--white);
}

.barra .marca {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--white) 16%, transparent);
}

.barra nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}

.barra nav a {
  padding: 9px 13px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--white) 78%, transparent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.barra nav a[aria-current='page'] {
  background: color-mix(in srgb, var(--white) 18%, transparent);
  color: var(--white);
}

.conteudo {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

.abas {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.abas button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.abas button[aria-selected='true'] {
  background: var(--leaf);
  border-color: var(--leaf);
  color: var(--white);
}

.linha-ferramentas {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

.linha-ferramentas .campo {
  flex: 1 1 190px;
}

/* ————— listas ————— */

.lista {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.item .foto {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--mint);
  display: grid;
  place-items: center;
  color: var(--leaf);
  font-size: 1.4rem;
}

.item h3 {
  margin: 0 0 3px;
  font-size: 1rem;
  line-height: 1.25;
}

.item .sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.item .direita {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.valor-alvo {
  font-weight: 800;
  color: var(--leaf);
  white-space: nowrap;
}

.vazio {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
}

/* ————— etiquetas ————— */

.etiqueta {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--mint);
  color: var(--leaf-dark);
}

.etiqueta.herdado {
  background: color-mix(in srgb, var(--blue) 14%, var(--white));
  color: var(--blue);
}

.etiqueta.pendente {
  background: color-mix(in srgb, var(--sun) 26%, var(--white));
  color: #7a5606;
}

.etiqueta.inativo {
  background: var(--line);
  color: var(--muted);
}

/* ————— painel lateral (nunca fecha por clique no fundo) ————— */

.fundo {
  position: fixed;
  inset: 0;
  background: rgba(29, 42, 34, 0.45);
  z-index: 40;
}

.painel-lateral {
  position: fixed;
  z-index: 41;
  inset: 0 0 0 auto;
  width: min(100%, 460px);
  background: var(--paper);
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: var(--shadow);
}

.painel-lateral header,
.painel-lateral footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.painel-lateral footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

.painel-lateral header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.painel-lateral header {
  padding-top: calc(14px + env(safe-area-inset-top));
}

.fechar {
  margin-left: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 1.1rem;
  cursor: pointer;
}

.corpo-painel {
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.dupla {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dica {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Prévia do alvo no cadastro — o número vem do servidor, nunca da tela. */
.previa {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--raio);
  background: var(--mint);
  border: 1px solid color-mix(in srgb, var(--leaf) 22%, var(--line));
}

.previa.pendente {
  background: color-mix(in srgb, var(--sun) 16%, var(--white));
  border-color: color-mix(in srgb, var(--sun) 45%, var(--line));
}

.previa .numero {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--leaf-dark);
}

.previa small {
  color: var(--muted);
  line-height: 1.45;
}

.tostada {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  max-width: min(92vw, 460px);
  text-align: center;
}

.tostada.ruim {
  background: var(--tomato);
}

@media (max-width: 520px) {
  .dupla {
    grid-template-columns: 1fr;
  }

  .item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .item .foto {
    width: 48px;
    height: 48px;
  }

  .item .direita {
    grid-column: 1 / -1;
    justify-items: start;
    flex-direction: row;
  }
}

[hidden] {
  display: none !important;
}
