/* ==========================================================================
   Belliór • Controle de Caixa — Estilos
   Paleta: bordô / bege / branco, inspirada na identidade visual da marca.
   Tipografia: Mulish. A marca "Belliór" usa a logo em SVG (assets/logo-bellior.svg).
   ========================================================================== */

:root {
  /* Bordô */
  --bordo-900: #591C2F;
  --bordo-700: #73253D;
  --bordo-600: #8C3A52;
  --bordo-500: #A85068;
  --bordo-100: #F3E4E8;

  /* Dourado (acento) */
  --gold-600: #AE8E59;
  --gold-400: #C6A876;

  /* Bege / superfícies */
  --bege-100: #FAF7F1;
  --bege-200: #F5F0E7;
  --bege-300: #EFE7DA;
  --bege-400: #E3DAC9;

  --white: #FFFFFF;

  /* Texto */
  --ink: #2E1D24;
  --ink-soft: #5E4750;
  --ink-faint: #9C8890;

  /* Estados */
  --success: #3F7D5C;
  --success-bg: #E7F1EB;
  --danger: #B3402C;
  --danger-bg: #FBEAE6;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 10px rgba(89, 28, 47, 0.06), 0 10px 30px rgba(89, 28, 47, 0.06);
  --shadow-float: 0 12px 32px rgba(89, 28, 47, 0.16);

  --font-body: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  color-scheme: light;
}

* { box-sizing: border-box; }

/* O atributo [hidden] deve sempre vencer, mesmo sobre regras com display:flex. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overscroll-behavior-y: contain;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bege-200);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

button, input {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

svg { display: block; width: 22px; height: 22px; }

.visually-hidden-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   Tela de Login
   ========================================================================== */

.screen-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% -10%, var(--bordo-600) 0%, transparent 55%),
    linear-gradient(160deg, var(--bordo-900) 0%, var(--bordo-700) 55%, var(--bordo-600) 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bege-100);
  border-radius: var(--radius-lg);
  padding: 40px 28px 32px;
  box-shadow: var(--shadow-float);
  text-align: center;
  animation: rise .5s var(--ease-spring);
}

.brand-logo {
  display: block;
  height: 76px;
  width: auto;
  margin: 0 auto 18px;
}

.brand-subtitle {
  margin: 2px 0 30px;
  color: var(--gold-600);
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 600;
}

.login-form { text-align: left; }

/* ==========================================================================
   Campos de formulário
   ========================================================================== */

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--bege-400);
  background: var(--white);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.field input::placeholder { color: var(--ink-faint); font-weight: 500; }

.field input:focus {
  outline: none;
  border-color: var(--bordo-600);
  box-shadow: 0 0 0 4px var(--bordo-100);
}

.field-password { position: relative; }
.field-password input { padding-right: 52px; }
.icon-btn-ghost {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
  border-radius: var(--radius-pill);
}
.icon-btn-ghost:active { background: var(--bege-300); }

.field-money {
  display: flex;
  align-items: center;
  height: 64px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--bege-400);
  background: var(--white);
  padding: 0 18px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field-money:focus-within {
  border-color: var(--bordo-600);
  box-shadow: 0 0 0 4px var(--bordo-100);
}
.field-money-prefix {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-faint);
  margin-right: 8px;
}
.field-money input {
  border: none;
  outline: none;
  background: none;
  width: 100%;
  font-size: 28px;
  font-weight: 800;
  color: var(--bordo-700);
  padding: 0;
  font-variant-numeric: tabular-nums;
}

.field-error {
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  margin: -6px 0 14px;
}

.field-search {
  position: relative;
  margin: 4px 20px 14px;
}
.field-search-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  color: var(--ink-faint);
}
.field-search input {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--bege-400);
  background: var(--white);
  padding: 0 18px 0 46px;
  font-size: 16px;
  font-weight: 600;
}
.field-search input:focus {
  outline: none;
  border-color: var(--bordo-600);
  box-shadow: 0 0 0 4px var(--bordo-100);
}

/* ==========================================================================
   Botões
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  transition: transform .15s var(--ease), background .2s var(--ease), opacity .2s var(--ease);
  width: 100%;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }

.btn-lg { height: 60px; font-size: 17px; border-radius: var(--radius-md); }

.btn-primary {
  background: var(--bordo-700);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(115, 37, 61, .28);
}
.btn-primary:active { background: var(--bordo-900); }

.btn-secondary {
  background: var(--bege-300);
  color: var(--ink);
}
.btn-secondary:active { background: var(--bege-400); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger-ghost {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px auto 4px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14.5px;
  padding: 10px 14px;
}
.btn-text svg { width: 17px; height: 17px; }
.btn-text:active { color: var(--bordo-700); }

.btn-spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.is-loading .btn-label { opacity: .5; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  color: var(--bordo-700);
  background: var(--white);
  box-shadow: var(--shadow-card);
}
.icon-btn:active { background: var(--bege-300); }

/* ==========================================================================
   Casca do app / navegação
   ========================================================================== */

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  position: relative;
}

.screen {
  display: none;
  padding: 18px 20px 28px;
  animation: fade-up .35s var(--ease);
}
.screen.is-active { display: block; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 18px;
}
.app-header-back { gap: 12px; justify-content: flex-start; }

.app-eyebrow-logo {
  display: block;
  height: 22px;
  width: auto;
  margin: 0 0 4px;
}
.app-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--bordo-700);
  margin: 0;
}

.sync-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-bg);
  transition: background .3s var(--ease);
}
.sync-dot.is-syncing {
  background: var(--gold-600);
  box-shadow: 0 0 0 4px var(--bege-300);
  animation: pulse 1s ease-in-out infinite;
}
.sync-dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-bg);
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

.install-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 496px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bordo-900);
  color: var(--bege-100);
  border-radius: var(--radius-md);
  padding: 14px 40px 14px 16px;
  box-shadow: var(--shadow-float);
  z-index: 35;
  animation: rise .4s var(--ease-spring);
}
.install-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(250,247,241,.14);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-400);
}
.install-icon svg { width: 18px; height: 18px; }
.install-text {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: rgba(250,247,241,.92);
}
.install-text strong { color: var(--gold-400); }
.install-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(250,247,241,.65);
}
.install-close svg { width: 15px; height: 15px; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  background: var(--bege-100);
  border-top: 1px solid var(--bege-400);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: color .2s var(--ease);
}
.nav-btn svg { width: 22px; height: 22px; transition: transform .2s var(--ease-spring); }
.nav-btn.is-active { color: var(--bordo-700); }
.nav-btn.is-active svg { transform: translateY(-1px) scale(1.05); }
.nav-btn:active svg { transform: scale(.9); }

/* ==========================================================================
   Início — card de destaque e formulário de venda
   ========================================================================== */

.hero-card {
  background: linear-gradient(155deg, var(--bordo-700), var(--bordo-900));
  border-radius: var(--radius-lg);
  padding: 26px 24px 24px;
  color: var(--bege-100);
  margin-bottom: 22px;
  box-shadow: 0 14px 30px rgba(89,28,47,.22);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -40px; top: -60px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(198,168,118,.22), transparent 70%);
}
.hero-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: 8px;
}
.hero-value {
  display: block;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  transition: transform .25s var(--ease-spring);
}
.hero-value.is-bumping { transform: scale(1.04); }
.hero-meta {
  display: block;
  margin-top: 8px;
  font-size: 13.5px;
  color: rgba(250,247,241,.72);
  font-weight: 600;
}

.venda-form { margin-bottom: 4px; }

/* ==========================================================================
   Histórico — cartões de dia
   ========================================================================== */

.day-list { display: flex; flex-direction: column; gap: 12px; }

.day-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform .15s var(--ease);
}
.day-card:active { transform: scale(.98); }

.day-card-date { font-size: 15.5px; font-weight: 800; color: var(--ink); }
.day-card-count { font-size: 13px; color: var(--ink-faint); font-weight: 600; margin-top: 2px; }
.day-card-value { font-size: 19px; font-weight: 800; color: var(--bordo-700); font-variant-numeric: tabular-nums; }

.empty-state {
  text-align: center;
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 14.5px;
  padding: 40px 20px;
}

/* ==========================================================================
   Detalhe do dia / listas de venda
   ========================================================================== */

.detail-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.detail-summary > div {
  flex: 1;
  background: var(--bege-300);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.detail-summary-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.detail-summary-value {
  display: block;
  font-size: 21px;
  font-weight: 800;
  color: var(--bordo-700);
  font-variant-numeric: tabular-nums;
}

.venda-list { display: flex; flex-direction: column; gap: 10px; }

.venda-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  box-shadow: var(--shadow-card);
}
.venda-row:active { transform: scale(.98); }

.venda-row-name { font-size: 15.5px; font-weight: 700; color: var(--ink); }
.venda-row-time { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; margin-top: 2px; }
.venda-row-value { font-size: 16.5px; font-weight: 800; color: var(--bordo-700); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Busca
   ========================================================================== */

.search-summary {
  background: var(--bege-300);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 0 0 14px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.search-summary strong { color: var(--bordo-700); }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.kpi-tile {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px 16px;
  box-shadow: var(--shadow-card);
}
.kpi-tile-accent {
  grid-column: span 2;
  background: linear-gradient(155deg, var(--bordo-700), var(--bordo-900));
}
.kpi-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.kpi-tile-accent .kpi-label { color: var(--gold-400); }
.kpi-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi-tile-accent .kpi-value { color: var(--white); font-size: 26px; }

.chart-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 16px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.chart-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin: 2px 4px 12px;
}
.chart-subtitle {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  margin-top: 1px;
}
.chart-svg-wrap { width: 100%; }
.chart-svg-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }

.chart-bar { fill: var(--bordo-600); }
.chart-bar-empty { fill: var(--bege-300); }
.chart-axis { stroke: var(--bege-400); stroke-width: 1; }
.chart-label { fill: var(--ink-faint); font-size: 10px; font-weight: 600; font-family: var(--font-body); }
.chart-value-label { fill: var(--ink-soft); font-size: 10px; font-weight: 700; font-family: var(--font-body); }
.chart-line { fill: none; stroke: var(--bordo-700); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: var(--bordo-600); opacity: .1; }
.chart-dot { fill: var(--bordo-700); stroke: var(--white); stroke-width: 2; }

/* Tooltip do gráfico */
.chart-tooltip {
  position: absolute;
  background: var(--ink);
  color: var(--bege-100);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s var(--ease);
  z-index: 5;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-svg-wrap { position: relative; }

/* ==========================================================================
   Relatórios
   ========================================================================== */

.segmented {
  display: flex;
  background: var(--bege-300);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 20px;
}
.segmented-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.segmented-btn.is-active {
  background: var(--bordo-700);
  color: var(--white);
}

.report-list {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--bege-300);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.report-row:last-child { border-bottom: none; }
.report-row strong { color: var(--bordo-700); font-size: 16px; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Sucesso ao salvar
   ========================================================================== */

.success-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  transition: opacity .2s var(--ease);
}
.success-overlay.is-visible { opacity: 1; }

.success-badge {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-float);
  display: flex; align-items: center; justify-content: center;
  color: var(--success);
  transform: scale(.6);
  transition: transform .3s var(--ease-spring);
}
.success-overlay.is-visible .success-badge { transform: scale(1); }
.success-badge svg { width: 56px; height: 56px; }

.success-circle {
  stroke-dasharray: 152;
  stroke-dashoffset: 152;
}
.success-overlay.is-visible .success-circle {
  animation: draw .5s var(--ease) forwards;
}
.success-check {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
}
.success-overlay.is-visible .success-check {
  animation: draw .3s var(--ease) .35s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ==========================================================================
   Bottom sheets, backdrop, confirmação, toast
   ========================================================================== */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(46, 29, 36, .45);
  z-index: 60;
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.bottom-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bege-100);
  border-radius: 26px 26px 0 0;
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  z-index: 65;
  box-shadow: 0 -12px 30px rgba(89,28,47,.18);
  animation: sheet-up .3s var(--ease-spring);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-handle {
  width: 40px; height: 4px;
  border-radius: var(--radius-pill);
  background: var(--bege-400);
  margin: 8px auto 16px;
}
.sheet-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 2px;
}
.sheet-meta {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-faint);
  margin: 0 0 18px;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-cancel { width: 100%; }

.confirm-dialog {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(46, 29, 36, .45);
  z-index: 80;
  padding: 24px;
  animation: fade-in .2s var(--ease);
}
.confirm-card {
  width: 100%;
  max-width: 360px;
  background: var(--bege-100);
  border-radius: var(--radius-lg);
  padding: 26px 22px 22px;
  box-shadow: var(--shadow-float);
  animation: rise .25s var(--ease-spring);
}
.confirm-message {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin: 4px 0 20px;
  line-height: 1.4;
}
.confirm-actions { display: flex; gap: 10px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast {
  position: fixed;
  left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--bege-100);
  font-size: 13.5px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  z-index: 90;
  opacity: 0;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  max-width: 86%;
  text-align: center;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.is-danger { background: var(--danger); }

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

/* ==========================================================================
   Responsivo
   ========================================================================== */

@media (min-width: 560px) {
  .login-card { padding: 48px 40px 40px; }
}

@media (max-width: 340px) {
  .hero-value { font-size: 36px; }
  .kpi-grid { gap: 10px; }
}
