/* ══════════════════════════════════════════════════════════════════
   GalloEcom Web — Design System (transposto de app/theme.py)
   Tema ESCURO (Aurora Dark navy) ↔ CLARO (SaaS híbrido). Toggle na titlebar.
   Todas as cores/raios vêm de variáveis; troca de tema = html.light.
   ══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── ESCURO (padrão) — _DARK do theme.py ── */
  --bg: #06091A; --bg2: #0A1024; --card: #0D1430; --card2: #121A3D; --hover: #111830; --input: #0A0F26;
  --blue: #1B4FD8; --blue2: #3B7AFA; --blue-light: #60A5FA; --blue-bg: #0D1F4E;
  --border: rgba(255,255,255,0.08); --border2: rgba(255,255,255,0.16); --divider: rgba(255,255,255,0.06);
  --ink: #FFFFFF; --ink2: rgba(255,255,255,0.72); --ink3: rgba(255,255,255,0.45);
  --green: #34D399; --green-bg: rgba(52,211,153,0.15);
  --red: #F87171;   --red-bg: rgba(248,113,113,0.15);
  --amber: #FBBF24; --amber-bg: rgba(251,191,36,0.15);
  --purple: #A78BFA; --purple-bg: rgba(167,139,250,0.18);
  --side-bg: #070B1C; --side-border: rgba(255,255,255,0.08); --side-text: rgba(255,255,255,0.72);
  --side-strong: #FFFFFF; --side-active-bg: #16264F; --side-active-text: #60A5FA; --side-accent: #3B7AFA; --side-hover: rgba(255,255,255,0.06);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --r4: 6px; --r8: 10px; --r12: 14px; --r16: 18px;
  --font: 'Outfit', -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Easing forte (Emil Kowalski) — as curvas nativas do CSS são fracas demais. */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --trans: all .16s var(--ease-out);
}
html.light {
  --bg: #F4F7FC; --bg2: #EEF2F9; --card: #FFFFFF; --card2: #FFFFFF; --hover: #F1F5FB; --input: #FFFFFF;
  --blue: #1B4FD8; --blue2: #2563EB; --blue-light: #3B7AFA; --blue-bg: #E5EDFC;
  --border: #E2E8F0; --border2: #CBD5E1; --divider: #EDF1F7;
  --ink: #0F172A; --ink2: #334155; --ink3: #64748B;
  --green: #16A34A; --green-bg: #DCFCE7;
  --red: #DC2626;   --red-bg: #FEE2E2;
  --amber: #D97706; --amber-bg: #FEF3C7;
  --purple: #7C3AED; --purple-bg: #EDE9FE;
  --side-bg: #FFFFFF; --side-border: #E8EDF4; --side-text: #475569;
  --side-strong: #0F172A; --side-active-bg: #E8F0FE; --side-active-text: #2563EB; --side-accent: #2563EB; --side-hover: #F1F5FB;
  --shadow: 0 8px 24px rgba(15,23,42,0.08);
}

html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 13.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
input, button, select, textarea { font-family: var(--font); color: inherit; }
button { cursor: pointer; outline: none; border: none; background: none; }
.hidden { display: none !important; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-red { color: var(--red) !important; } .text-amber { color: var(--amber) !important; }
.text-blue { color: var(--blue2) !important; } .text-green { color: var(--green) !important; }

/* ── LAYOUT ── */
#app { display: flex; height: 100vh; overflow: hidden; }
#sidebar { width: 236px; flex-shrink: 0; background: var(--side-bg); border-right: 1px solid var(--side-border); display: flex; flex-direction: column; padding: 18px 12px; }
#main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#titlebar { height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--divider); background: var(--side-bg); }
#topbar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 20px 28px 6px; }
#content { flex: 1; overflow-y: auto; padding: 8px 28px 40px; }
.page { max-width: 1500px; }

/* ── TITLEBAR ── */
.tb-left { display: flex; align-items: center; gap: 9px; }
.tb-logo-text { font-size: 14px; font-weight: 800; letter-spacing: -.3px; color: var(--side-strong); }
.tb-logo-text em { color: var(--blue2); font-style: normal; }
.tb-page-name { font-size: 12px; color: var(--ink3); font-weight: 500; }

/* ── SIDEBAR ── */
.sb-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 18px; }
.sb-logo img { filter: drop-shadow(0 4px 12px rgba(59,122,250,.35)); }
.sb-title { font-size: 19px; font-weight: 800; letter-spacing: -.4px; color: var(--side-strong); }
.sb-title em { color: var(--blue2); font-style: normal; }
.sb-tagline { font-size: 11px; color: var(--ink3); letter-spacing: .4px; }
.sb-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.sb-section { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--ink3); margin: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r8); color: var(--side-text); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: var(--trans); position: relative; }
.nav-item i { font-size: 18px; width: 20px; text-align: center; opacity: .9; }
.nav-item:hover { background: var(--side-hover); color: var(--side-strong); }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active-text); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--side-accent); }
.nav-item.special { color: var(--side-active-text); font-weight: 600; }
.nav-item.special i { color: var(--side-active-text); }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
/* pills de filtro (ex.: Boletos no dashboard) */
.pill-btn { padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink2); background: var(--hover); border: 1px solid var(--border); transition: var(--trans); }
.pill-btn:hover { color: var(--ink); }
.pill-btn.active { background: linear-gradient(135deg, var(--blue2), var(--blue)); color: #fff; border-color: transparent; }
.sb-footer { padding-top: 14px; border-top: 1px solid var(--divider); }
.sb-user { font-size: 11.5px; color: var(--ink3); margin-bottom: 8px; word-break: break-all; display: flex; align-items: center; gap: 5px; }

/* ── TOPBAR (cabeçalho de conteúdo) ── */
.topbar-title { font-size: 21px; font-weight: 800; letter-spacing: -.4px; color: var(--ink); }
.topbar-sub { font-size: 12.5px; color: var(--ink3); margin-top: 1px; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* ── BOTÕES ── */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: linear-gradient(135deg, var(--blue2), var(--blue)); color: #fff; border-radius: var(--r8); padding: 0 16px; height: 36px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(27,79,216,.3); transition: var(--trans); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: transparent; color: var(--ink2); border: 1px solid var(--border2); border-radius: var(--r8); padding: 0 14px; height: 36px; font-size: 13px; font-weight: 500; transition: var(--trans); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--red-bg); color: var(--red); border: 1px solid transparent; border-radius: var(--r8); padding: 0 14px; height: 36px; font-size: 13px; font-weight: 600; transition: var(--trans); }
.btn-danger:hover { filter: brightness(1.05); }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r8); color: var(--ink3); transition: var(--trans); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn i { font-size: 17px; }

/* ── KPI CARDS ── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 14px 0 22px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--r16); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi-ic { width: 36px; height: 36px; border-radius: var(--r8); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.kpi-ic i { font-size: 19px; }
.kpi.red .kpi-ic { background: var(--red-bg); color: var(--red); }
.kpi.amber .kpi-ic { background: var(--amber-bg); color: var(--amber); }
.kpi.blue .kpi-ic { background: var(--blue-bg); color: var(--blue-light); }
.kpi.green .kpi-ic { background: var(--green-bg); color: var(--green); }
.kpi.purple .kpi-ic { background: var(--purple-bg); color: var(--purple); }
.kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--ink2); margin-top: 4px; font-weight: 500; }
.kpi-sub { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }

/* ── METRIC CARDS (dashboard premium: valor + tendência + sparkline) ── */
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 14px 0 20px; }
.mcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--r16); box-shadow: var(--shadow); padding: 16px 18px 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.mcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcard-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.mcard-ic { width: 28px; height: 28px; border-radius: var(--r8); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.mcard-val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); line-height: 1.05; }
.mcard-spark { margin: 4px -18px 0; }
.mcard { animation: gallo-fade .3s var(--ease-out) both; }
.mcard:nth-child(2) { animation-delay: 45ms; } .mcard:nth-child(3) { animation-delay: 90ms; } .mcard:nth-child(4) { animation-delay: 135ms; }

/* ── CARD + TABELA ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r16); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--divider); }
.card-hd-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.card-hd-sub { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.card-body { padding: 20px 22px; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { position: sticky; top: 0; background: var(--bg2); color: var(--ink3); text-align: right; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; padding: 12px 16px; white-space: nowrap; border-bottom: 1px solid var(--border); }
thead th:first-child, thead th:nth-child(2) { text-align: left; }
tbody td { padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--divider); white-space: nowrap; color: var(--ink2); }
tbody td:first-child, tbody td:nth-child(2) { text-align: left; }
tbody tr:hover { background: var(--hover); }
.td-mono { font-family: ui-monospace, Consolas, monospace; color: var(--blue-light); font-size: 12px; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue-light); }
.badge-gray { background: var(--hover); color: var(--ink3); }

/* ── ESTADO VAZIO ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink3); }
.empty-state i { font-size: 40px; opacity: .5; }
.empty-state h3 { color: var(--ink2); margin: 10px 0 4px; font-size: 16px; }

/* ── PROGRESS ── */
.progress-track { height: 6px; background: var(--hover); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; }

/* ── MODAL ── */
#modal-overlay { position: fixed; inset: 0; background: rgba(3,6,16,.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--border2); border-radius: var(--r16); box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--divider); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { color: var(--ink3); font-size: 20px; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--divider); }
.confirm-modal { max-width: 380px; text-align: center; }
.confirm-modal .modal-body { padding: 28px 22px 10px; }
.confirm-modal h3 { margin: 12px 0 6px; }
.confirm-modal p { color: var(--ink3); font-size: 13px; }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto; }
.confirm-icon.danger { background: var(--red-bg); color: var(--red); }
.confirm-icon.amber { background: var(--amber-bg); color: var(--amber); }

/* ── FORM FIELDS ── */
.fld-l { display: block; font-size: 11.5px; color: var(--ink2); font-weight: 600; margin: 12px 0 6px; }
.fld-l:first-child { margin-top: 0; }
.fld { width: 100%; background: var(--input); border: 1px solid var(--border); border-radius: var(--r8); padding: 10px 12px; font-size: 13.5px; color: var(--ink); outline: none; transition: var(--trans); }
.fld:focus { border-color: var(--blue-light); box-shadow: 0 0 0 3px var(--blue-bg); }
select.fld { cursor: pointer; }
select.fld option { background: var(--card); color: var(--ink); }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--card); border: 1px solid var(--border2); border-left: 3px solid var(--green); border-radius: var(--r8); padding: 12px 16px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: all .3s; }
.toast.error { border-left-color: var(--red); }
.toast i { font-size: 18px; color: var(--green); }
.toast.error i { color: var(--red); }

/* ── CALENDÁRIO ── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink3); text-transform: uppercase; letter-spacing: .5px; }
.cal-cell { min-height: 84px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r8); padding: 6px; }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-day { font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: 4px; }
.cal-ev { font-size: 11px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border-radius: var(--r4); padding: 2px 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.pago { color: var(--green); background: var(--green-bg); }
.cal-ev.parcela { border-left: 2px solid var(--blue2); }

/* ── AUTH (login / pendente) ── */
.auth-wrap { height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 560px at 82% -12%, rgba(59,122,250,.14), transparent 60%),
    radial-gradient(820px 460px at -12% 112%, rgba(167,139,250,.10), transparent 60%),
    var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border2); border-radius: var(--r16); padding: 36px 32px; box-shadow: var(--shadow); text-align: center; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 12px; }
.auth-brand img { filter: drop-shadow(0 8px 20px rgba(59,122,250,.4)); }
.auth-title { font-size: 25px; font-weight: 800; letter-spacing: -.5px; }
.auth-title em { color: var(--blue2); font-style: normal; }
.auth-tagline { font-size: 12px; color: var(--ink3); margin-top: 2px; letter-spacing: .3px; }
.auth-form { margin-top: 26px; text-align: left; }
.auth-form label { display: block; font-size: 11.5px; color: var(--ink2); margin: 14px 0 6px; font-weight: 600; }
.auth-field { display: flex; align-items: center; gap: 8px; background: var(--input); border: 1px solid var(--border); border-radius: var(--r8); padding: 0 12px; transition: var(--trans); }
.auth-field:focus-within { border-color: var(--blue-light); box-shadow: 0 0 0 3px var(--blue-bg); }
.auth-field i { color: var(--ink3); font-size: 16px; }
.auth-field input { flex: 1; background: transparent; border: none; outline: none; padding: 11px 0; font-size: 14px; color: var(--ink); }
.auth-btn { width: 100%; height: 44px; margin-top: 22px; font-size: 14px; }
.auth-msg { margin-top: 14px; font-size: 12.5px; min-height: 18px; text-align: center; }
.auth-msg.err { color: var(--red); } .auth-msg.ok { color: var(--green); }
.auth-switch { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--ink3); }
.auth-switch a { color: var(--blue2); cursor: pointer; font-weight: 600; }

/* ── FUNDO ANIMADO DO LOGIN (recriação vanilla do ShaderGradient) ──
   Cores da sua marca GalloEcom: #0f1fff · #589edb · #7a58e1. Movimento lento
   (uSpeed 0.4 → 20s), brilho 1.2, grão ligado. Sem React/WebGL/dependência. */
#login-view { position: relative; overflow: hidden; }
#login-view::before {                       /* o "plano" de gradiente que deriva */
  content: ""; position: absolute; inset: -30%; z-index: 0;
  background:
    radial-gradient(42% 55% at 20% 28%, #0f1fff 0%, transparent 60%),
    radial-gradient(46% 56% at 80% 22%, #7a58e1 0%, transparent 60%),
    radial-gradient(58% 62% at 62% 82%, #589edb 0%, transparent 62%),
    radial-gradient(50% 55% at 30% 78%, #0f1fff 0%, transparent 58%),
    linear-gradient(135deg, #0a1030, #142a6b 55%, #241a5c);
  filter: blur(22px) saturate(1.15) brightness(1.2);
  animation: shaderDrift 16s linear infinite;
  will-change: transform;
}
#login-view::after {                        /* grão (grain="on") */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#login-view > .auth-card {                  /* cartão flutua nítido sobre o gradiente */
  position: relative; z-index: 2;
  box-shadow: 0 30px 80px rgba(8, 14, 48, .5);
  border-color: rgba(255, 255, 255, .55);
}
/* Loop contínuo (0%=100%) para fluir sem parar; scale sempre >1.1 pra o desfoque
   nunca mostrar a borda do elemento. */
@keyframes shaderDrift {
  0%   { transform: translate(-5%, -4%) rotate(-8deg) scale(1.18); }
  25%  { transform: translate(5%, -2%) rotate(3deg)  scale(1.24); }
  50%  { transform: translate(4%, 5%)  rotate(9deg)  scale(1.18); }
  75%  { transform: translate(-4%, 3%) rotate(2deg)  scale(1.24); }
  100% { transform: translate(-5%, -4%) rotate(-8deg) scale(1.18); }
}
/* Exceção decorativa (escolha do Carlos): o fundo do login roda SEMPRE, mesmo com
   "reduzir movimento" ligado no sistema. O resto do app continua respeitando. */

/* ══════════════════════════════════════════════════════════════════
   POLIMENTO — design engineering (Emil Kowalski). Só movimento e
   resposta ao toque: não altera cores nem layout. Aplica-se a TODO o
   app (dashboard, tabelas, modais, toasts, login) por ser central.
   ══════════════════════════════════════════════════════════════════ */

/* Resposta ao pressionar: todo clicável "afunda" 3% — feedback instantâneo
   de que a interface ouviu o toque (nunca use ease-in aqui). */
.btn-primary, .btn-ghost, .btn-danger, .icon-btn, .pill-btn, .nav-item,
.modal-close, .auth-btn, .auth-switch a {
  transition: background .16s var(--ease-out), color .16s var(--ease-out),
              border-color .16s var(--ease-out), filter .16s var(--ease-out),
              box-shadow .16s var(--ease-out), transform .12s var(--ease-out);
}
.btn-primary:active, .btn-ghost:active, .btn-danger:active,
.icon-btn:active, .pill-btn:active, .nav-item:active, .auth-btn:active {
  transform: scale(.97);
}
/* O primário sobe no hover, mas o pressionar (scale) sempre vence. */
.btn-primary:active { transform: scale(.97); }

/* Foco de teclado visível (acessibilidade) sem poluir o uso com mouse. */
.btn-primary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible,
.icon-btn:focus-visible, .pill-btn:focus-visible, .nav-item:focus-visible {
  box-shadow: 0 0 0 3px var(--blue-bg), 0 0 0 1px var(--blue-light);
}

/* Entrada de tela: o conteúdo sobe 6px e aparece a cada troca de página
   (rápido, 220ms — presença sem atrasar). */
.page { animation: gallo-rise .22s var(--ease-out) both; }
@keyframes gallo-rise { from { opacity: 0; transform: translateY(6px); } }

/* KPIs entram em cascata suave (stagger só de opacidade, sem duplo movimento). */
.kpi { animation: gallo-fade .3s var(--ease-out) both; }
.kpi:nth-child(2) { animation-delay: 45ms; }
.kpi:nth-child(3) { animation-delay: 90ms; }
.kpi:nth-child(4) { animation-delay: 135ms; }
.kpi:nth-child(5) { animation-delay: 180ms; }

/* Modal: overlay dá fade; o cartão CRESCE de 0.96 (do centro) — nada surge
   de scale(0), que parece vir do nada. Modal é centrado → origin center. */
#modal-overlay { animation: gallo-fade .18s var(--ease-out) both; }
.modal { animation: gallo-pop .22s var(--ease-out) both; transform-origin: center; }
@keyframes gallo-fade { from { opacity: 0; } }
@keyframes gallo-pop { from { opacity: 0; transform: scale(.96); } }

/* Toast: entra deslizando da direita (mesma direção da saída = intuitivo).
   @starting-style + transição (não keyframe) → interrompível e sem "grudar"
   a opacidade, para o fade de saída via JS (el.style.opacity=0) funcionar. */
.toast { transition: transform .3s var(--ease-out), opacity .3s var(--ease-out); }
@starting-style { .toast { opacity: 0; transform: translateX(16px) scale(.97); } }

/* Login: o cartão aparece com presença (fade + leve zoom do centro). */
.auth-card { animation: gallo-pop .34s var(--ease-out) both; }

/* Tabela: hover instantâneo, sem "arrasto". Barras animam o preenchimento. */
tbody tr { transition: background .12s var(--ease-out); }
.progress-fill { transition: width .5s var(--ease-in-out); }

/* Menos movimento p/ quem tem sensibilidade vestibular: mantém fades/cores,
   remove deslocamentos (Emil: reduzir, não zerar). */
@media (prefers-reduced-motion: reduce) {
  /* Troca deslocamentos por um fade curto; toast fica de fora (o fade de
     saída dele é via JS e não pode ser "grudado" por um both). */
  .page, .kpi, .modal, #modal-overlay, .auth-card { animation: gallo-fade .18s ease both; }
  *, *::before, *::after { transition-duration: .09s !important; }
  .btn-primary:active, .btn-ghost:active, .btn-danger:active,
  .icon-btn:active, .pill-btn:active, .nav-item:active, .auth-btn:active { transform: none; }
}

/* ── INTRO (vídeo de abertura em tela cheia + botão Pular) ─────────────────── */
#intro-view {
  position: fixed; inset: 0; z-index: 9999;
  background: #000; display: flex; align-items: center; justify-content: center;
  animation: gallo-fade .3s ease both;
}
#intro-view.hidden { display: none; }
#intro-video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
#intro-view.fechando { animation: introSaida .5s cubic-bezier(.23,1,.32,1) both; }
@keyframes introSaida { to { opacity: 0; transform: scale(1.04); } }
#intro-controls {
  position: fixed; right: 22px; bottom: 22px; z-index: 10000;
  display: flex; align-items: center; gap: 10px;
}
#intro-skip, #intro-sound {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 20px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 700; color: #fff;
  background: rgba(15, 18, 30, .55); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 22px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.18);
  transition: transform .16s var(--ease-out), background .16s var(--ease-out);
}
#intro-sound { background: rgba(59,122,250,.62); }
#intro-skip:hover { background: rgba(15,18,30,.78); }
#intro-sound:hover { background: rgba(59,122,250,.82); }
#intro-skip:active, #intro-sound:active { transform: scale(.96); }
#intro-skip i, #intro-sound i { font-size: 16px; }
@media (max-width: 520px) { #intro-controls { right: 14px; bottom: 14px; gap: 8px; } #intro-skip, #intro-sound { padding: 10px 15px; font-size: 13px; } }

/* ── VENDAS (extrato por pedido) ─────────────────────────────────── */
.venda-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r12); margin-bottom: 12px; overflow: hidden; transition: var(--trans); }
.venda-card:hover { border-color: var(--border2); }
.venda-cancelada { opacity: .6; }
.venda-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 16px; border-bottom: 1px solid var(--divider); font-size: 12px; color: var(--ink3); }
.venda-head i { color: var(--ink3); }
.venda-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.venda-main { display: flex; align-items: center; gap: 16px; padding: 14px 16px; cursor: pointer; transition: background .16s var(--ease-out); }
.venda-main:hover { background: var(--hover); }
.venda-item { display: flex; align-items: center; gap: 12px; width: 300px; flex: 0 0 auto; min-width: 0; }
.venda-foto { width: 46px; height: 46px; border-radius: var(--r8); object-fit: cover; background: var(--input); border: 1px solid var(--border); flex: 0 0 auto; }
.venda-foto-vazia { display: flex; align-items: center; justify-content: center; color: var(--ink3); font-size: 20px; }
.venda-tit { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venda-metrics { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.venda-metric { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 72px; }
.venda-metric-lbl { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); }
.venda-metric-val { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.venda-chevron { font-size: 18px; color: var(--ink3); flex: 0 0 auto; transition: transform .18s var(--ease-out); }
.venda-detail { padding: 16px; background: var(--bg2); border-top: 1px solid var(--divider); }
.venda-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.venda-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--divider); font-size: 12.5px; }
.venda-info span { color: var(--ink3); }
.venda-info b { color: var(--ink); font-weight: 600; }
.venda-fin { display: flex; flex-direction: column; }
.venda-fin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; color: var(--ink2); }
.venda-fin-row > span { display: flex; align-items: center; gap: 9px; }
.venda-fin-ic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: 0 0 auto; }
.venda-fin-total { border-top: 1px solid var(--border2); margin-top: 6px; padding-top: 12px; font-weight: 700; color: var(--ink); }
@media (max-width: 900px) {
  .venda-detail-grid { grid-template-columns: 1fr; }
  .venda-item { width: 100%; }
  .venda-main { flex-wrap: wrap; }
  .venda-metrics { justify-content: flex-start; }
}

/* ══ FINANCEIRO (DRE mensal) ══════════════════════════════════════ */
.mes-nav { display: flex; align-items: center; gap: 6px; }
.mes-nav-lbl { font-size: 14px; font-weight: 800; color: var(--ink); min-width: 132px; text-align: center; }
.dre-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.dre-card .card-body { padding: 18px 20px; }
.dre-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.dre-title i { color: var(--blue-light); }
.dre-sec { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); margin: 14px 0 2px; }
.dre-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13.5px; color: var(--ink2); border-bottom: 1px solid var(--divider); }
.dre-lbl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dre-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--hover); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: 0 0 auto; }
.dre-val { font-weight: 700; white-space: nowrap; }
.dre-top { border-bottom: 1px solid var(--border2); }
.dre-top .dre-val, .dre-top .dre-lbl { font-size: 15px; font-weight: 800; }
.dre-sub { border-bottom: none; border-top: 1px dashed var(--border2); margin-top: 2px; padding-top: 10px; font-weight: 700; color: var(--ink); }
.dre-sub b { font-size: 14.5px; }
.dre-margem { font-size: 11px; font-weight: 800; color: var(--purple); background: var(--purple-bg); padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.dre-margem.big { font-size: 14px; background: none; padding: 0; }
.dre-final { border-bottom: none; border-top: 2px solid var(--border2); margin-top: 8px; padding-top: 14px; }
.dre-final .dre-lbl { font-size: 15px; font-weight: 800; color: var(--ink); }
.dre-loading { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink3); }
.dre-loading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dre-nota { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--ink3); background: var(--bg2); border-radius: var(--r8); padding: 9px 12px; margin-top: 10px; }
.dre-nota.red { color: var(--red); background: var(--red-bg); }
.dre-nota i { margin-top: 1px; flex: 0 0 auto; }
.dre-conceitos { margin-top: 10px; }
.dre-conceitos > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--blue-light); display: flex; align-items: center; gap: 7px; padding: 6px 0; list-style: none; }
.dre-conceitos > summary::-webkit-details-marker { display: none; }
.dre-conceitos-body { padding: 4px 0 2px; }
.dre-conceitos-body .dre-sub { font-weight: 500; color: var(--ink2); border-top: 1px solid var(--divider); }
/* Custos operacionais */
.custo-bloco { margin-bottom: 16px; }
.custo-bloco-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.custo-bloco-hd i { color: var(--ink3); }
.custo-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); background: var(--hover); padding: 2px 7px; border-radius: 999px; margin-left: 4px; }
.custo-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--divider); }
.custo-nome { flex: 1; min-width: 0; font-size: 13px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custo-valor { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.custo-total { border-bottom: none; border-top: 1px dashed var(--border2); margin-top: 2px; padding-top: 9px; }
.custo-total .custo-nome { font-weight: 700; color: var(--ink); }
.custo-vazio { font-size: 12px; color: var(--ink3); padding: 8px 0 10px; }
@media (max-width: 1000px) { .dre-grid { grid-template-columns: 1fr; } }
