/* Cores da B.A Embriões. O app troca estes valores pela paleta salva no
   Supabase (empresa_identidade.paleta), então outra empresa ganha as suas cores. */
:root {
  --bg: #eef4f0;
  --surface: #ffffff;
  --surface2: #f4f8f5;
  --surface3: #e6efe9;
  --hdr1: #0f3d2e;
  --hdr2: #1b6b46;
  --hdrInk: #f2fbf6;
  --primaria: #1b6b46;
  --text: #132420;
  --textMuted: #4d5f57;
  --textFaint: #7f9188;
  --border: #d8e4dc;
  --borderStrong: #c3d4c9;
  --accent: #3a5a8c;
  --accentSoft: #e1e9f4;
  --perigo: #b42318;
  --perigoSoft: #fdecea;
  --aviso: #8a5a00;
  --avisoSoft: #fff4d6;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(15, 61, 46, .08), 0 4px 16px rgba(15, 61, 46, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

[hidden] { display: none !important; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, var(--hdr1), var(--hdr2));
}

.login-cartao {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}

.marca {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.marca-sigla {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primaria);
  color: var(--hdrInk);
  font-weight: 800;
  letter-spacing: .5px;
}

.marca-nome { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.marca-produto { color: var(--textMuted); font-size: .9rem; }

.login h2 { margin: 0 0 16px; font-size: 1.1rem; }

.links-login {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ---------- Formulários ---------- */
.campo { display: grid; gap: 4px; margin-bottom: 12px; }
.campo label { font-size: .875rem; font-weight: 600; color: var(--textMuted); }

.campo input, .campo select, .campo textarea, .busca {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borderStrong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.campo input:focus, .campo select:focus, .busca:focus {
  outline: 2px solid var(--primaria);
  outline-offset: 1px;
  border-color: var(--primaria);
}

.grade-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 12px;
}

/* ---------- Botões ---------- */
.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primaria);
  color: var(--hdrInk);
  font-weight: 600;
  cursor: pointer;
}

.botao:hover { filter: brightness(1.08); }
.botao:disabled { opacity: .6; cursor: wait; }
.botao.largo { width: 100%; }

.botao.secundario {
  background: var(--surface);
  color: var(--primaria);
  border-color: var(--borderStrong);
}

.botao.perigo {
  background: var(--surface);
  color: var(--perigo);
  border-color: #f0c4bf;
}

.botao.pequeno { padding: 6px 10px; font-size: .875rem; }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primaria);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Estrutura do app ---------- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.lateral {
  background: linear-gradient(180deg, var(--hdr1), var(--hdr2));
  color: var(--hdrInk);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lateral .marca { margin: 0 6px 8px; }
.lateral .marca-sigla { background: rgba(255, 255, 255, .15); }
.lateral .marca-produto { color: rgba(242, 251, 246, .75); }

.menu { display: grid; gap: 4px; }

.menu a {
  color: var(--hdrInk);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
}

.menu a:hover { background: rgba(255, 255, 255, .1); }
.menu a.ativo { background: rgba(255, 255, 255, .2); font-weight: 700; }

.usuario {
  margin-top: auto;
  font-size: .85rem;
  color: rgba(242, 251, 246, .85);
  display: grid;
  gap: 8px;
  word-break: break-all;
}

.usuario select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 0;
}

.usuario .botao { background: rgba(255, 255, 255, .15); }

.topo-movel { display: none; }

.conteudo { padding: 28px; min-width: 0; }

.cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cabecalho h1, .cabecalho h2 { margin: 0; }
.cabecalho h1 { font-size: 1.5rem; }
.cabecalho h2 { font-size: 1.15rem; }

.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acoes .busca { width: 220px; max-width: 100%; }

.cartao {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 18px;
  margin-bottom: 20px;
}

.indicadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.indicador {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--primaria);
  border-radius: var(--raio);
  padding: 14px 16px;
}

.indicador .numero { font-size: 1.8rem; font-weight: 800; color: var(--primaria); }
.indicador .rotulo { color: var(--textMuted); font-size: .9rem; }

/* ---------- Tabelas ---------- */
.rolagem { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--surface2);
  color: var(--textMuted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .4px;
}

tbody tr:hover { background: var(--surface2); }
td.num, th.num { text-align: right; }

.vazio { color: var(--textFaint); padding: 24px 12px; text-align: center; }

.selo {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--avisoSoft);
  color: var(--aviso);
}

/* ---------- Janela (formulário) ---------- */
.fundo-janela {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 22, .5);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.janela {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 14px;
  padding: 22px;
}

.janela h2 { margin: 0 0 16px; }
.janela .acoes { justify-content: flex-end; margin-top: 8px; }

/* ---------- Avisos ---------- */
.mensagem {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: .925rem;
  background: var(--surface3);
}

.mensagem.erro { background: var(--perigoSoft); color: var(--perigo); }

.aviso-flutuante {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--hdr1);
  color: var(--hdrInk);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--sombra);
  z-index: 60;
  max-width: calc(100vw - 32px);
}

.aviso-flutuante.erro { background: var(--perigo); }

.centro { min-height: 60vh; display: grid; place-items: center; text-align: center; color: var(--textMuted); }

/* ---------- Celular ---------- */
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }

  .topo-movel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--hdr1);
    color: var(--hdrInk);
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .topo-movel .botao { background: rgba(255, 255, 255, .15); }

  .lateral {
    display: none;
    position: fixed;
    inset: 0 30% 0 0;
    min-width: 240px;
    z-index: 45;
    overflow-y: auto;
  }

  .lateral.aberta { display: flex; }

  .conteudo { padding: 16px; }
}
