/* ==========================================================================
   Pizzaria Financeiro — Design System
   Conceito: "cupom fiscal" — cartões com borda serrilhada, tipografia de
   ticket, cores tiradas do próprio prato (tomate / manjericão).
   Mobile-first: tudo é desenhado para telão de 375px primeiro.
   ========================================================================== */

:root {
  /* Paleta */
  --paper: #F7F6F3;
  --paper-raised: #FFFFFF;
  --ink: #211D18;
  --ink-soft: #6B6559;
  --ink-faint: #A39C8D;
  --line: #E7E2D8;

  --tomate: #C1421A;
  --tomate-dark: #9E3414;
  --tomate-soft: #FBE7DD;

  --manjericao: #3A7D44;
  --manjericao-soft: #E4F1E3;

  --ambar: #B9790A;
  --ambar-soft: #FBEDD3;

  --muzzarella: #FFF8EA;

  /* Tipografia */
  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Espaçamento / raio */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 2px rgba(33, 29, 24, 0.04), 0 8px 24px -12px rgba(33, 29, 24, 0.12);
  --shadow-float: 0 12px 28px -8px rgba(193, 66, 26, 0.35);

  --bottom-nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
}

body.no-nav { padding-bottom: 24px; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-body); font-weight: 800; letter-spacing: -0.01em; }

.numero-destaque {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Foco visível para acessibilidade / navegação por teclado */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2.5px solid var(--tomate);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------------- */
/* Cabeçalho                                                               */
/* ---------------------------------------------------------------------- */
.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  max-width: 720px;
  margin: 0 auto;
}

.topo__marca {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topo__logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--tomate);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}

.topo__titulo { font-size: 15px; font-weight: 800; line-height: 1.15; }
.topo__sub { font-size: 12px; color: var(--ink-soft); }

.topo__acao {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------- */
/* Contêiner geral                                                        */
/* ---------------------------------------------------------------------- */
.tela {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.tela__cabecalho h1 { font-size: 21px; }

/* ---------------------------------------------------------------------- */
/* Cartão "cupom fiscal" — elemento-assinatura                            */
/* ---------------------------------------------------------------------- */
.cupom {
  position: relative;
  background: var(--paper-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 22px 26px;
  margin-bottom: 18px;
}

.cupom::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -8px;
  height: 16px;
  background-image: radial-gradient(circle 5px, var(--paper) 5px, transparent 5.5px);
  background-size: 20px 20px;
  background-position: 0 -4px;
}

.cupom__linha-picotada {
  border: none;
  border-top: 2px dashed var(--line);
  margin: 16px 0;
}

/* ---------------------------------------------------------------------- */
/* Card genérico                                                          */
/* ---------------------------------------------------------------------- */
.card {
  background: var(--paper-raised);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 14px;
}

.card__titulo {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------- */
/* Saldo hero                                                              */
/* ---------------------------------------------------------------------- */
.saldo-hero__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 700;
}

.saldo-hero__valor {
  font-size: 42px;
  line-height: 1.1;
  margin: 4px 0 2px;
}

.saldo-hero__valor.positivo { color: var(--manjericao); }
.saldo-hero__valor.negativo { color: var(--tomate); }

.saldo-hero__periodo { font-size: 13px; color: var(--ink-faint); }

.saldo-hero__grade {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.mini-stat {
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.mini-stat__label {
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.mini-stat__valor {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  margin-top: 4px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--entrada { background: var(--manjericao); }
.dot--saida { background: var(--tomate); }

/* ---------------------------------------------------------------------- */
/* Alertas / badges                                                       */
/* ---------------------------------------------------------------------- */
.alerta {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
}

.alerta--negativo { background: var(--tomate-soft); color: var(--tomate-dark); }
.alerta--sucesso { background: var(--manjericao-soft); color: #24552b; }
.alerta--aviso { background: var(--ambar-soft); color: #7a5106; }
.alerta--info { background: #EAF1F8; color: #2C4C6B; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--ativo { background: var(--manjericao-soft); color: #24552b; }
.badge--inativo { background: #ECE8DF; color: var(--ink-soft); }
.badge--origem { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }

/* ---------------------------------------------------------------------- */
/* Listas tipo "linha de recibo"                                          */
/* ---------------------------------------------------------------------- */
.lista-recibo { list-style: none; margin: 0; padding: 0; }

.recibo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

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

.recibo-item__icone {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 15px;
}

.recibo-item__corpo { flex: 1; min-width: 0; }
.recibo-item__titulo { font-weight: 700; font-size: 14px; }
.recibo-item__meta { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

.recibo-item__valor {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
}

.recibo-item__valor.positivo { color: var(--manjericao); }
.recibo-item__valor.negativo { color: var(--tomate); }

.vazio {
  text-align: center;
  padding: 30px 10px;
  color: var(--ink-faint);
  font-size: 13.5px;
}

.vazio__icone { font-size: 28px; margin-bottom: 8px; display: block; }

/* ---------------------------------------------------------------------- */
/* Botões                                                                  */
/* ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn--primario { background: var(--tomate); color: #fff; box-shadow: var(--shadow-float); }
.btn--primario:hover { background: var(--tomate-dark); }

.btn--secundario { background: var(--paper-raised); color: var(--ink); border: 1.5px solid var(--line); }
.btn--secundario:hover { border-color: var(--ink-faint); }

.btn--fantasma { background: transparent; color: var(--ink-soft); padding: 13px 10px; }

.btn--perigo { background: var(--tomate-soft); color: var(--tomate-dark); }

.btn--bloco { width: 100%; }

.btn--sm { padding: 8px 14px; font-size: 13px; border-radius: 9px; }

.btn--icone {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

/* ---------------------------------------------------------------------- */
/* Formulários                                                            */
/* ---------------------------------------------------------------------- */
.campo { margin-bottom: 16px; }

.campo label,
.campo__label {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 7px;
}

.campo__ajuda { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 15.5px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B6559'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  padding-right: 40px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--tomate);
  box-shadow: 0 0 0 3.5px var(--tomate-soft);
  outline: none;
}

.form-control-color { padding: 4px; height: 46px; cursor: pointer; }

.campo-valor {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper-raised);
  padding: 0 14px;
}

.campo-valor:focus-within { border-color: var(--tomate); box-shadow: 0 0 0 3.5px var(--tomate-soft); }

.campo-valor__prefixo {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-faint);
  padding-right: 6px;
}

.campo-valor input {
  border: none !important;
  box-shadow: none !important;
  font-family: var(--font-mono);
  font-size: 22px !important;
  font-weight: 700;
  padding-left: 0 !important;
}

.campo-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.form-check-input {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  accent-color: var(--tomate);
  flex-shrink: 0;
}

.campo-check label { margin: 0; text-transform: none; font-size: 14px; font-weight: 600; color: var(--ink); }

/* Segmentado (tipo Entrada/Saída) */
.segmentado {
  display: flex;
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.segmentado input { display: none; }

.segmentado label {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: none;
  margin: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmentado input:checked + label {
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ---------------------------------------------------------------------- */
/* Chips de filtro (scroll horizontal)                                    */
/* ---------------------------------------------------------------------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 9px 15px;
  border-radius: 100px;
  background: var(--paper-raised);
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.chip.ativo { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------------------------------------------------------------- */
/* Tabela (desktop) / lista (mobile) para histórico                       */
/* ---------------------------------------------------------------------- */
.tabela-wrap { overflow-x: auto; }

table.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.tabela th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 800;
  padding: 0 10px 10px;
  border-bottom: 1.5px solid var(--line);
}

table.tabela td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.tabela tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------------- */
/* Navegação inferior fixa (mobile-first, tipo app nativo)                */
/* ---------------------------------------------------------------------- */
.nav-inferior {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 10px;
  flex: 1;
}

.nav-item__icone { font-size: 19px; line-height: 1; }
.nav-item.ativo { color: var(--tomate); }

.nav-fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--tomate);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  box-shadow: var(--shadow-float);
  margin-top: -30px;
  border: 4px solid var(--paper);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------- */
/* Autenticação (login, reset de senha)                                   */
/* ---------------------------------------------------------------------- */
.tela-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 22px;
  background:
    radial-gradient(circle at 15% 8%, var(--tomate-soft), transparent 45%),
    radial-gradient(circle at 90% 90%, var(--manjericao-soft), transparent 40%),
    var(--paper);
}

.tela-auth__marca {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-align: center;
}

.tela-auth__logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--tomate);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  box-shadow: var(--shadow-float);
}

.tela-auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 24px;
}

.tela-auth__rodape {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------- */
/* Mensagens (Django messages)                                            */
/* ---------------------------------------------------------------------- */
.mensagens { max-width: 720px; margin: 0 auto 4px; padding: 0 20px; }

/* ---------------------------------------------------------------------- */
/* Paginação                                                              */
/* ---------------------------------------------------------------------- */
.paginacao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------- */
/* Utilitários                                                            */
/* ---------------------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.texto-soft { color: var(--ink-soft); }
.texto-sm { font-size: 12.5px; }

/* ---------------------------------------------------------------------- */
/* Responsivo — telas maiores (tablet/desktop)                            */
/* ---------------------------------------------------------------------- */
@media (min-width: 640px) {
  body { font-size: 15.5px; }
  .saldo-hero__valor { font-size: 48px; }
  .tela__cabecalho h1 { font-size: 24px; }
  .cupom { padding: 30px 28px 32px; }
}

@media (min-width: 860px) {
  body { padding-bottom: 32px; }
  .nav-inferior { display: none; }
  body.tem-nav-desktop { padding-top: 0; }

  .app-shell {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
    max-width: 1180px;
    margin: 0 auto;
  }

  .lateral {
    padding: 28px 18px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
  }

  .lateral__marca {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 10px;
  }

  .lateral__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 11px;
    font-weight: 700;
    font-size: 14px;
    color: var(--ink-soft);
  }

  .lateral__item.ativo { background: var(--tomate-soft); color: var(--tomate-dark); }
  .lateral__item:hover:not(.ativo) { background: var(--paper); }

  .lateral__rodape { margin-top: auto; padding: 0 10px; }

  .conteudo { padding: 32px 36px 48px; max-width: 760px; }
  .conteudo .tela { padding: 0; max-width: none; }
  .conteudo .topo { display: none; }
  .conteudo .mensagens { padding: 0; max-width: none; margin-bottom: 18px; }

  .saldo-hero__grade { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .dashboard-grade {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    align-items: start;
  }
}
