/* ============================================================
   BATECAIXA — style.css v2.3 (unificado)
   ============================================================ */

:root {
  --azul: #1565C0;
  --azul-esc: #0D47A1;
  --azul-cl: #E3F2FD;
  --ambar: #FF8F00;
  --ambar-cl: #FFF8E1;
  --ambar-esc: #E65100;
  --verde: #2E7D32;
  --verde-cl: #E8F5E9;
  --roxo: #3949AB;
  --roxo-cl: #E8EAF6;
  --verm: #C62828;
  --verm-cl: #FFEBEE;
  --bg: #F5F7FA;
  --borda: #E0E0E0;
  --texto: #546E7A;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── CONTAINER PRINCIPAL ──────────────────────────────────────
   width: 100% + max-width = centraliza no desktop, edge-to-edge no mobile.
   NUNCA use width: 450px fixo.
   ─────────────────────────────────────────────────────────── */
.container-app {
  width: 100%;
  max-width: 450px;
  background: #fff;
  min-height: 100vh;
  box-shadow: 0 0 30px rgba(0, 0, 0, .08);
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: 0 20px;
  overflow-x: hidden;
  /* safe-area para iPhone com notch */
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* ── TELAS ──────────────────────────────────────────────────── */
#tela-home,
#tela-trial,
#tela-bloqueio,
#tela-membro-email,
#tela-membro-confirmado,
#tela-membro-codigo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100vh;
  padding: 30px 0;
  width: 100%;
}

#tela-login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 30px 0;
  width: 100%;
}

/* ── LOGO ───────────────────────────────────────────────────── */
.logo-home {
  width: 120px;
  height: 120px;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border-radius: 0;
}

.logo-home--sm {
  width: 90px;
  height: 90px;
}

.logo-app {
  display: block;
  object-fit: contain;
}

.logo-app--home {
  height: 110px;
  width: auto;
  max-width: 100%;
}

.logo-app--login {
  height: 80px;
  width: auto;
  max-width: 100%;
}

.logo-app--header {
  height: 38px;
  width: auto;
  max-width: 160px;
  display: block;
}

.logo-app--sobre {
  height: 60px;
  width: auto;
  display: block;
  margin: 0 auto 10px;
}

/* ── BENEFÍCIOS ─────────────────────────────────────────────── */
.beneficio-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border-left: 4px solid var(--azul);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  text-align: left;
}

.beneficio-card:nth-child(2) {
  border-left-color: var(--ambar);
}

.beneficio-card:nth-child(3) {
  border-left-color: var(--roxo);
}

.beneficio-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 1px;
}

.beneficio-card strong {
  display: block;
  font-size: 14px;
  color: #333;
  margin-bottom: 3px;
}

.beneficio-card p {
  font-size: 13px;
  color: #78909C;
  margin: 0;
  line-height: 1.4;
}

/* ── BOTÃO GOOGLE ───────────────────────────────────────────── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  background: #fff;
  border: 2px solid var(--borda);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  cursor: pointer;
  transition: .2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  font-family: inherit;
}

.btn-google:hover {
  border-color: var(--azul);
  background: var(--azul-cl);
}

.btn-google:active {
  transform: scale(.98);
}

/* ── SEPARADOR OU ───────────────────────────────────────────── */
.separador-ou {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  width: 100%;
}

.separador-ou::before,
.separador-ou::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--borda);
}

.separador-ou span {
  font-size: 12px;
  color: #90A4AE;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── LOADING ────────────────────────────────────────────────── */
#tela-loading {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw !important;
  height: 100vh !important;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  background: white;
}

.loader {
  border: 5px solid #f0f0f0;
  border-top: 5px solid var(--ambar);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  animation: spin .9s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── CHECK ITEMS ────────────────────────────────────────────── */
.check-item {
  font-size: 14px;
  color: #444;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-weight: 500;
}

.check-item:last-child {
  border-bottom: none;
}

/* ── CARDS MÉTRICA ──────────────────────────────────────────── */
.card-metrica {
  color: #fff;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  padding: 16px clamp(14px, 4vw, 20px);
  border-radius: 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.card-metrica::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, .07);
  border-radius: 50%;
}

.card-metrica.azul {
  background: linear-gradient(135deg, var(--azul), var(--azul-esc));
}

.card-metrica.ambar {
  background: linear-gradient(135deg, var(--ambar), var(--ambar-esc));
}

.card-metrica-titulo {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .8;
  margin: 0;
}

.card-metrica-valor {
  font-size: 30px;
  font-weight: 900;
  margin: 6px 0 0;
  letter-spacing: -1px;
}

/* ── MENU GRID ──────────────────────────────────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.menu-btn {
  background: #fff;
  border: 1.5px solid var(--borda);
  border-radius: 14px;
  padding: 22px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: .15s;
  min-height: 90px;
  font-family: inherit;
}

.menu-btn:active {
  transform: scale(.97);
  background: #f0f4ff;
  border-color: var(--azul);
}

.menu-icon {
  font-size: 30px;
  margin-bottom: 8px;
}

.menu-text {
  font-size: 13px;
  font-weight: 700;
  color: #37474F;
  line-height: 1.2;
}

.menu-btn-grande {
  width: 100%;
  margin-top: 15px;
  padding: 20px;
  background: var(--verde-cl);
  border: 1.5px solid #A5D6A7;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 800;
  color: var(--verde);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: .15s;
  font-family: inherit;
}

.menu-btn-grande:active {
  transform: scale(.98);
}

/* ── TOGGLE MODO VENDA ──────────────────────────────────────── */
.modo-toggle {
  display: flex;
  gap: 0;
  background: #f5f5f5;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 5px;
}

.modo-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: #78909C;
  background: transparent;
  cursor: pointer;
  transition: .2s;
  font-family: inherit;
  text-align: center;
}

.modo-btn.active {
  background: #fff;
  color: var(--azul);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.descricao-modo {
  font-size: 12px;
  color: #90A4AE;
  margin: 0 0 15px;
  line-height: 1.5;
  background: var(--azul-cl);
  border-radius: 8px;
  padding: 10px 12px;
}

/* ── RADIO PAGAMENTO ────────────────────────────────────────── */
.pagamento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.radio-pagamento {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border: 1.5px solid var(--borda);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  transition: .15s;
}

.radio-pagamento:has(input:checked) {
  background: var(--azul-cl);
  border-color: var(--azul);
  color: var(--azul);
}

.radio-pagamento input {
  accent-color: var(--azul);
  transform: scale(1.2);
}

/* ── HEADER TELA ────────────────────────────────────────────── */
.header-tela {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 8px 0 14px;
  border-bottom: 1px solid #eee;
}

.header-tela h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #333;
  text-align: center;
  flex: 1;
}

.btn-voltar-topo {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--texto);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: .15s;
}

.btn-voltar-topo:active {
  background: #f5f5f5;
}

/* ── INPUTS ─────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #37474F;
  margin-top: 16px;
}

input[type=text],
input[type=date],
input[type=month],
input[type=email],
input[type=tel],
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  margin-top: 6px;
  border: 1.5px solid var(--borda);
  border-radius: 10px;
  box-sizing: border-box;
  font-size: 16px !important;
  background: #FAFCFF;
  color: #333;
  font-family: inherit;
  transition: .2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--azul);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .1);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23546E7A' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.grid-valores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 5px;
}

.grid-valores label {
  margin-top: 10px;
  font-size: 13px;
}

.grid-valores input {
  padding: 11px 12px;
  font-size: 15px !important;
}

/* ── BOTÕES ─────────────────────────────────────────────────── */
.btn-primario {
  display: block;
  background: var(--verde);
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  transition: .2s;
  font-family: inherit;
  text-align: center;
}

.btn-primario:active {
  opacity: .85;
  transform: scale(.99);
}

.btn-primario:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.btn-voltar {
  display: block;
  background: transparent;
  color: var(--texto);
  border: 1.5px solid var(--borda);
  padding: 13px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  font-family: inherit;
  text-align: center;
  transition: .2s;
}

.btn-voltar:active {
  background: #f5f5f5;
}

/* ── FILTROS ────────────────────────────────────────────────── */
.filtros-box {
  background: var(--azul-cl);
  border: 1px solid #90CAF9;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
}

.grid-filtros-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filtros-box label {
  font-size: 12px;
  color: var(--azul);
  margin-top: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.filtros-box input,
.filtros-box select {
  padding: 9px 10px;
  font-size: 13px !important;
  background: #fff;
  margin-top: 4px;
  border-color: #90CAF9;
}

/* ── CARDS DE ITEM ──────────────────────────────────────────── */
.item-card {
  background: #fff;
  border-left: 4px solid var(--azul);
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

.item-card-compra {
  border-left-color: var(--ambar-esc);
}

.item-card-membro {
  border-left-color: var(--roxo);
}

.item-card-cliente {
  border-left-color: #00897B;
}

.item-card-forn {
  border-left-color: var(--ambar);
}

.acoes-card {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f5f5f5;
}

.btn-acao {
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}

.btn-acao:active {
  transform: scale(.97);
}

.btn-editar {
  background: #FFF8E1;
  color: var(--ambar-esc);
}

.btn-excluir {
  background: var(--verm-cl);
  color: var(--verm);
}

.btn-wpp {
  background: var(--verde-cl);
  color: var(--verde);
}

/* ── RELATÓRIOS ─────────────────────────────────────────────── */
.relatorio-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 15px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  border: 1px solid #f0f0f0;
}

.stat-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #90A4AE;
  margin-bottom: 6px;
}

.stat-card strong {
  font-size: 14px;
  display: block;
  font-weight: 900;
}

/* ── ABAS COM SETAS ─────────────────────────────────────────── */
.tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.tab-arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #fff;
  border: 1.5px solid var(--borda);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 900;
  color: #546E7A;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: .15s;
  font-family: inherit;
  padding: 0;
}

.tab-arrow:hover {
  background: var(--azul-cl);
  border-color: var(--azul);
  color: var(--azul);
}

.tab-arrow:active {
  transform: scale(.93);
}

.tabs-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding: 4px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 1.5px solid var(--borda);
  border-radius: 20px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: #78909C;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
  font-family: inherit;
}

.tab-btn.active {
  background: var(--azul-cl);
  border-color: var(--azul);
  color: var(--azul);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── BADGES ─────────────────────────────────────────────────── */
.badge-papel {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-vendedor {
  background: var(--verde-cl);
  color: var(--verde);
}

.badge-gerente {
  background: var(--roxo-cl);
  color: var(--roxo);
}

.badge-dono {
  background: var(--ambar-cl);
  color: var(--ambar-esc);
}

.badge-ativo {
  background: var(--verde-cl);
  color: var(--verde);
}

.badge-suspenso {
  background: var(--verm-cl);
  color: var(--verm);
}

.badge-trial {
  background: var(--ambar-cl);
  color: var(--ambar-esc);
}

.badge-pendente {
  background: #F3E5F5;
  color: #7B1FA2;
}

/* ── TOAST ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  width: 92%;
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: #323232;
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  animation: slideUp .25s ease, fadeOut .4s ease 2.6s forwards;
  pointer-events: auto;
  line-height: 1.4;
  text-align: center;
}

.toast.sucesso {
  background: var(--verde);
}

.toast.erro {
  background: var(--verm);
}

.toast.aviso {
  background: var(--ambar-esc);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    pointer-events: none;
  }
}

/* ── MODAIS ─────────────────────────────────────────────────────────────────
   Abordagem "Modal Elástico":
   - A rolagem ocorre no .modal-overlay (fundo escuro), nunca no .modal-box
   - .modal-box cresce com o conteúdo — sem barra de rolagem interna
   - body.overflow = hidden (aplicado via JS ao abrir) trava o fundo
   ────────────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  z-index: 9998;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: flex-start;
  /* alinha ao topo para permitir crescimento */
  justify-content: center;
  padding: 5vh 16px;
  /* respiro visual no topo e base */
  box-sizing: border-box;
  overflow-y: auto;
  /* rolagem no overlay, não no box */
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: #fff;
  width: 100%;
  max-width: 420px;
  max-height: none;
  /* SEM limite — cresce com o conteúdo */
  height: auto;
  overflow-y: visible;
  /* SEM barra de rolagem interna */
  box-sizing: border-box;
  border-radius: 18px;
  padding: 24px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: modalEntrar .25s ease-out;
  margin: auto 0;
  /* centraliza verticalmente quando couber */
}

@keyframes modalEntrar {
  from {
    opacity: 0;
    transform: translateY(30px) scale(.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── OUTROS ─────────────────────────────────────────────────── */
.link-nota {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--azul);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  background: var(--azul-cl);
  padding: 3px 9px;
  border-radius: 20px;
}

#tela-dashboard,
#tela-lancar-vendas,
#tela-historico,
#tela-compras,
#tela-relatorios,
#tela-configuracoes,
#tela-admin {
  animation: fadeInUp .2s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1,
h2,
h3 {
  letter-spacing: -.3px;
}

p {
  margin: 0 0 8px;
  line-height: 1.5;
}

/* ── RESPONSIVO ─────────────────────────────────────────────── */

/* Desktop: sombra e centralização */
@media (min-width: 601px) {
  .container-app {
    box-shadow: 0 0 30px rgba(0, 0, 0, .08);
  }
}

/* ── MOBILE FULLSCREEN FIX ──────────────────────────────────────
   Edge-to-edge: container ocupa 100% da largura, sem margens
   que espremem o conteúdo em telas pequenas.
   ─────────────────────────────────────────────────────────────*/
@media (max-width: 600px) {
  body {
    padding: 0 !important;
    background: white !important;
  }

  .container-app {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

/* Telas muito pequenas: fonte menor para evitar zoom iOS */
@media (max-width: 360px) {

  input,
  select,
  textarea,
  button {
    font-size: 15px !important;
  }
}
