/* Base: variáveis, reset, tipografia, layout do shell, formulários, toast.
   Mobile only, tela ao sol: alto contraste, alvos de toque >= 48px. */

:root {
  --fundo: #120A18;
  --fundo-2: #1D1226;
  --fundo-3: #2A1A36;
  --borda: #3A2749;
  --texto: #F5EFFA;
  --texto-2: #B9A8C9;
  --acento: #FF4D2E;
  --secundario: #D62BC4;
  --ok: #22C55E;
  --alerta: #EAB308;
  --perigo: #F43F5E;
  --titulo: "Bricolage Grotesque", system-ui, sans-serif;
  --corpo: "Figtree", system-ui, sans-serif;
  --raio: 14px;
  --nav-altura: 64px;
  --cabecalho-altura: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* O atributo hidden precisa vencer as regras de display abaixo: qualquer
   regra de display escrita aqui derruba o [hidden] padrão do navegador,
   e o elemento continua aparecendo mesmo "escondido". */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--corpo);
  background: var(--fundo);
  color: var(--texto);
  height: 100dvh;
  overflow: hidden; /* só o conteúdo interno rola */
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--titulo); line-height: 1.15; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font: inherit;
  color: var(--texto);
  background: var(--fundo-3);
  border: 1px solid var(--borda);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  min-height: 48px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--secundario);
  outline-offset: 1px;
  border-color: transparent;
}

label { display: block; font-weight: 600; font-size: 0.9rem; }
label > input, label > select { margin-top: 6px; font-weight: 400; }

a { color: var(--secundario); text-decoration: none; }

::selection { background: var(--secundario); color: #fff; }

/* ---------- splash ---------- */

#tela-carregando {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
}
#tela-carregando h1 { font-size: 3rem; color: var(--acento); }
#tela-carregando p { color: var(--texto-2); }

/* ---------- shell do app ---------- */

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}

/* Cabeçalho fixo e compacto: logo pequena, nome da loja em destaque,
   rótulo da tela discreto. Respeita a barra de status do celular. */
#cabecalho {
  flex: none;
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--cabecalho-altura) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 16px;
  background: var(--fundo);
}
#cabecalho::after { /* detalhe sutil de marca */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--acento), var(--secundario) 60%, transparent);
  opacity: 0.6;
}
#cabecalho .logo { flex: none; width: 26px; height: 26px; }
.cabecalho-titulos {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
#titulo-vista {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--texto-2);
}
#nome-negocio {
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--texto);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#botao-sair {
  flex: none;
  color: var(--texto-2);
  font-size: 0.85rem;
  padding: 10px 12px;
  min-height: 48px;
}

/* Só esta área rola; os fixos ficam por cima e por baixo. */
#vista {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px;
  padding-bottom: calc(var(--nav-altura) + 84px + env(safe-area-inset-bottom));
}

#rodape-dia {
  position: fixed;
  left: 0; right: 0;
  z-index: 20;
  bottom: calc(var(--nav-altura) + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--fundo-2);
  border-top: 1px solid var(--borda);
  font-weight: 700;
}
#rodape-dia small { color: var(--texto-2); font-weight: 400; }

#menu {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-altura) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: var(--fundo-2);
  border-top: 1px solid var(--borda);
  z-index: 20;
}
#menu a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  color: var(--texto-2);
  font-size: 0.7rem;
  font-weight: 600;
}
#menu a .icone { font-size: 1.3rem; }
#menu a.ativa { color: var(--acento); }

/* ---------- botões ---------- */

.botao-principal {
  display: block;
  width: 100%;
  min-height: 56px;
  background: var(--acento);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: var(--raio);
  padding: 14px 18px;
}
.botao-principal:disabled { opacity: 0.5; }

.botao-secundario {
  display: block;
  width: 100%;
  min-height: 48px;
  background: var(--fundo-3);
  border: 1px solid var(--borda);
  font-weight: 600;
  border-radius: var(--raio);
  padding: 12px 16px;
}

.link {
  color: var(--secundario);
  font-weight: 600;
  padding: 8px 0;
  text-align: left;
}

.erro { color: var(--perigo); font-size: 0.9rem; }
.carregando { text-align: center; color: var(--texto-2); padding: 48px 0; }
.vazio { text-align: center; color: var(--texto-2); padding: 40px 12px; }

/* ---------- tela de autenticação ---------- */

#tela-auth {
  height: 100dvh;
  overflow-y: auto;
}

.auth {
  max-width: 400px;
  margin: 0 auto;
  padding: calc(48px + env(safe-area-inset-top)) 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-marca { text-align: center; margin-bottom: 8px; }
.auth-marca h1 { font-size: 3rem; color: var(--acento); }
.auth-marca p { color: var(--texto-2); }
.auth-abas {
  display: flex;
  background: var(--fundo-2);
  border-radius: var(--raio);
  padding: 4px;
}
.auth-abas button {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  color: var(--texto-2);
  font-weight: 600;
}
.auth-abas button.ativa { background: var(--fundo-3); color: var(--texto); }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth-ou { text-align: center; color: var(--texto-2); font-size: 0.85rem; }

/* ---------- toast ---------- */

#area-toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(var(--nav-altura) + 16px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--fundo-3);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
  animation: toast-sobe 0.25s ease;
}
.toast button {
  color: var(--acento);
  font-weight: 700;
  min-height: 48px;
  padding: 0 8px;
  white-space: nowrap;
}
.toast.sumindo { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-sobe { from { transform: translateY(12px); opacity: 0; } }
