:root {
  color-scheme: light;
  --bg: #1c3036;
  --espresso: #1c3036;
  --chocolate: #28444d;
  --premium: #385e6b;
  --bronze: #60a0c0;
  --ouro: #60c0ff;
  --bege: #d7e5ec;
  --creme: #edf6fa;
  --branco: #f7fbfd;
  --cocoa: #20363d;
  --caramel: #406060;
  --gold: #80c0e0;
  --cream: #f4f9fb;
  --card: rgba(255, 255, 255, 0.92);
  --card2: rgba(232, 247, 250, 0.86);
  --text: #071827;
  --muted: #40566f;
  --line: rgba(15, 23, 42, 0.16);
  --blue: #0ea5e9;
  --green: #10b981;
  --red: #e11d48;
  --amber: #d97706;
  --purple: #7c3aed;
  --radius: 22px;
}

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

html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(96, 192, 255, 0.26), transparent 60%),
    radial-gradient(760px 420px at 86% 8%, rgba(64, 96, 128, 0.32), transparent 62%),
    linear-gradient(180deg, #385e6b 0%, #28444d 48%, #1c3036 100%),
    var(--bg);
  background-attachment: fixed;
}

svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.hidden { display: none !important; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(22px, 5.2vw, 30px); }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
.muted, small { color: var(--muted); }

.card {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--card), var(--card2));
  border-radius: var(--radius);
  box-shadow: 0 18px 42px rgba(0, 49, 74, 0.22);
  backdrop-filter: blur(16px);
}

/* ================= LOGIN ================= */
.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(18px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  overflow: hidden;
  color: var(--branco);
  background: var(--espresso);
}

.login-fundo {
  position: absolute;
  inset: 0;
  background: url('logo.jpeg') center bottom / cover no-repeat;
  filter: brightness(.72) saturate(1.08) contrast(1.04);
  transform: scale(1.06);
}

.login-vinheta {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(96,192,255,.28), transparent 36%),
    radial-gradient(circle at 10% 88%, rgba(64,96,128,.40), transparent 28%),
    linear-gradient(145deg, rgba(28,48,54,.72), rgba(20,38,45,.74) 48%, rgba(10,24,30,.94)),
    rgba(10,24,30,.5);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: clamp(14px, 2.8vh, 22px);
  padding: clamp(22px, 5vw, 34px) clamp(18px, 5.4vw, 34px);
  border: 1px solid rgba(215,229,236,.28);
  border-radius: clamp(26px, 7vw, 38px);
  background:
    linear-gradient(160deg, rgba(56,94,107,.48), rgba(28,48,54,.68)),
    rgba(28,48,54,.34);
  box-shadow: 0 28px 70px rgba(0,0,0,.52), inset 0 1px 0 rgba(255,249,242,.14);
  backdrop-filter: blur(20px);
  animation: entrar-login .55s ease both;
  scrollbar-width: none;
}
.login-card::-webkit-scrollbar { display: none; }

.login-marca { text-align: center; display: grid; gap: 5px; animation: subir-login .6s ease both; }
.login-kicker {
  margin: 0 0 4px;
  color: var(--ouro);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .34em;
  text-transform: uppercase;
}
.login-logo {
  margin: 0;
  color: var(--branco);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(66px, 16vw, 88px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: .88;
  text-shadow: 0 4px 18px rgba(0,0,0,.42), 0 1px 0 rgba(255,255,255,.12);
}
.login-for-men {
  margin: 0 0 12px;
  color: var(--bege);
  font-size: clamp(10px, 2.5vw, 12px);
  font-weight: 800;
  letter-spacing: .32em;
  text-transform: uppercase;
}
.login-for-men span {
  display: inline-block;
  width: 34px;
  height: 1px;
  margin: 0 10px;
  background: linear-gradient(90deg, transparent, var(--ouro), transparent);
  vertical-align: middle;
}
.login-boas {
  margin: 0;
  color: var(--branco);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(19px, 5vw, 24px);
  font-weight: 500;
  letter-spacing: .08em;
}
.login-sub { margin: 0 auto; max-width: 300px; color: rgba(235,217,196,.82); font-size: 13px; line-height: 1.45; }

.campo { display: grid; gap: 7px; }
.campo-rotulo {
  padding-left: 4px;
  color: var(--bege);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.campo-caixa { position: relative; display: flex; }
.campo-caixa svg {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 19px;
  height: 19px;
  color: var(--ouro);
  transform: translateY(-50%);
  pointer-events: none;
}
.campo-caixa input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(214,166,117,.48);
  border-radius: 999px;
  padding: 14px 48px 14px 50px;
  font: inherit;
  font-size: 15px;
  color: var(--branco);
  background: rgba(245,237,227,.1);
  box-shadow: inset 0 1px 4px rgba(0,0,0,.28), 0 2px 10px rgba(0,0,0,.16);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.campo-caixa input::placeholder { color: rgba(235,217,196,.52); }
.campo-caixa input:focus {
  outline: none;
  border-color: var(--ouro);
  background: rgba(245,237,227,.16);
  box-shadow: 0 0 0 4px rgba(214,166,117,.16), inset 0 1px 4px rgba(0,0,0,.22);
}

.ver-senha {
  position: absolute;
  right: 7px;
  top: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--bege);
  background: rgba(245,237,227,.08);
  transform: translateY(-50%);
  cursor: pointer;
}
.ver-senha svg { width: 18px; height: 18px; position: static; transform: none; }
.ver-senha[aria-pressed="true"] .olho-corte { display: none; }

.btn-primary {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(255,249,242,.22);
  border-radius: 999px;
  padding: 16px 20px;
  font: inherit;
  font-weight: 850;
  color: var(--branco);
  background:
    linear-gradient(120deg, rgba(255,255,255,.2) 0 20%, transparent 45%),
    linear-gradient(120deg, #8b4f2d, #a66b42 48%, #5b2e1e);
  box-shadow: 0 18px 36px rgba(36,19,13,.44), inset 0 1px 0 rgba(255,255,255,.28);
  cursor: pointer;
  margin-top: 3px;
  text-shadow: 0 1px 2px rgba(24,10,6,.36);
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.btn-primary svg { width: 20px; height: 20px; }
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 1px 1px auto;
  height: 48%;
  border-radius: 13px 13px 48% 48%;
  background: linear-gradient(180deg, rgba(255,255,255,.24), transparent);
  pointer-events: none;
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 22px 42px rgba(36,19,13,.5), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-primary:active { transform: translateY(1px) scale(.99); }
.btn-primary:disabled { cursor: wait; filter: saturate(.86); opacity: .88; }
.btn-primary.is-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.login-seguro {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(235,217,196,.72);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-align: center;
}
.login-seguro svg { width: 15px; height: 15px; color: var(--ouro); }

@keyframes entrar-login {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes subir-login {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 380px), (max-height: 720px) {
  .login { padding: calc(10px + env(safe-area-inset-top)) 14px calc(10px + env(safe-area-inset-bottom)); }
  .login-card { gap: 11px; padding: 18px 15px; }
  .login-kicker { display: none; }
  .login-logo { font-size: clamp(58px, 19vw, 76px); }
  .login-boas { font-size: clamp(21px, 6vw, 28px); }
  .login-sub { font-size: 14px; }
  .campo-caixa input { min-height: 48px; }
  .btn-primary { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card, .login-marca, .btn-primary.is-loading::before { animation: none; }
  .campo-caixa input, .btn-primary, .ver-senha { transition: none; }
}

/* ================= APP / CASCA ================= */
.app {
  isolation: isolate;
  width: min(480px, 100%);
  max-width: 100vw;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: calc(8px + env(safe-area-inset-top)) 0 0;
  padding: 14px 14px 15px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--branco);
  background:
    linear-gradient(180deg, rgba(255, 249, 242, 0.16), rgba(255, 249, 242, 0) 46%),
    linear-gradient(155deg, #4a2c20 0%, #382116 48%, #24130d 100%);
  box-shadow:
    0 16px 34px rgba(36, 19, 13, 0.34),
    inset 0 1px 0 rgba(255, 249, 242, 0.28),
    inset 0 -12px 24px rgba(36, 19, 13, 0.28);
  backdrop-filter: blur(10px);
}
.topbar-titulo { min-width: 0; }
.topbar-titulo .eyebrow {
  margin: 0 0 3px;
  color: var(--ouro);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 2px rgba(3, 45, 48, 0.4);
}
.topbar-titulo .topbar-marca { color: var(--ouro); }
.topbar-titulo h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffffff; }
.topbar-titulo h1.titulo-destaque { color: #bfdbfe; text-shadow: 0 2px 10px rgba(37, 99, 235, 0.7); }
.topbar-acoes { display: flex; gap: 8px; flex: 0 0 auto; }

.icon-btn {
  width: 44px; height: 44px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 13px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: pointer;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.32); }

/* ================= SYNC STATUS ================= */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  margin-right: 8px;
}
.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  transition: background 0.3s, box-shadow 0.3s;
}
.sync-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.sync-dot.error { background: var(--red); box-shadow: 0 0 8px var(--red); }
.sync-dot.syncing { background: var(--blue); box-shadow: 0 0 8px var(--blue); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.sync-text {
  font-size: 11px; font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}
.sync-btn {
  width: 32px; height: 32px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sync-btn:active { background: rgba(255, 255, 255, 0.24); }
.sync-btn svg { width: 18px; height: 18px; }
.sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.periodo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  min-width: 0;
  overflow: hidden;
  padding: 14px 14px 16px;
  margin-bottom: 16px;
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 34px rgba(0, 72, 92, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.84);
}
.periodo label { min-width: 0; }
.date-field { position: relative; }
.date-field .date-value {
  display: block;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  padding: 12px 28px 12px 8px;
  border: 1px solid rgba(82, 120, 140, 0.25);
  border-radius: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.75), 0 3px 9px rgba(12, 69, 88, 0.07);
  text-align: center;
  font-size: clamp(12px, 3.35vw, 15px);
  font-weight: 850;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.date-field .date-value::after {
  content: "⌄";
  position: absolute;
  right: 10px;
  color: var(--bronze);
  font-size: 18px;
  line-height: 1;
}
.date-field input[type="date"] {
  position: absolute;
  inset: 21px 0 0;
  z-index: 2;
  width: 100%;
  height: 45px;
  min-width: 0;
  opacity: 0.01;
  cursor: pointer;
}
.date-field:focus-within .date-value {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16), inset 0 1px 1px rgba(255, 255, 255, 0.75);
}
.periodo-seta {
  display: block;
  width: 22px;
  height: 22px;
  color: var(--bronze);
  margin-bottom: 12px;
  justify-self: center;
}

.page { flex: 1; padding-bottom: 8px; }

/* --------- GRADE DE ICONES --------- */
.grade-modulos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.modulo {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.94), rgba(222, 244, 249, 0.90));
  box-shadow: 0 14px 34px rgba(0, 49, 74, 0.26);
  padding: 16px 12px 14px;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  min-height: 104px;
  align-content: center;
}
.modulo:active { transform: scale(0.97); }
.modulo-icone { width: 40px; height: 40px; padding: 8px; border-radius: 12px; }
.modulo span { font-size: 12.5px; font-weight: 900; line-height: 1.25; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.44); }
.modulo-consulta-produtos {
  color: #fff;
  border-color: #1d4ed8;
  background: linear-gradient(145deg, #1d4ed8, #4338ca 58%, #312e81);
  box-shadow: 0 16px 34px rgba(30, 64, 175, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.modulo-consulta-produtos span { text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35); }
.modulo-consulta-produtos .modulo-icone { color: #fff; background: rgba(255, 255, 255, 0.2); }

.c-blue { color: #0284c7; background: rgba(14, 165, 233, 0.20); }
.c-green { color: #059669; background: rgba(16, 185, 129, 0.20); }
.c-purple { color: #7c3aed; background: rgba(124, 58, 237, 0.18); }
.c-amber { color: #d97706; background: rgba(245, 158, 11, 0.22); }
.c-red { color: #e11d48; background: rgba(225, 29, 72, 0.18); }

/* --------- VOLTAR --------- */
.voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 2px 12px;
  cursor: pointer;
}
.voltar svg { width: 18px; height: 18px; }

/* --------- CONTEUDO --------- */
.bloco { padding: 16px; margin-bottom: 12px; }
.bloco-titulo { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.bloco-titulo small { font-size: 12px; }

.subtabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 1px 12px;
  margin-bottom: 2px;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 13px;
  color: var(--tab-color, var(--muted));
  background: rgba(255, 255, 255, 0.58);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.subtab-vendas { --tab-color: #0369a1; --tab-bg: linear-gradient(120deg, #7dd3fc, #38bdf8); }
.subtab-pagamentos { --tab-color: #047857; --tab-bg: linear-gradient(120deg, #6ee7b7, #22d3ee); }
.subtab-operadores { --tab-color: #6d28d9; --tab-bg: linear-gradient(120deg, #c4b5fd, #818cf8); }
.subtab-produtos { --tab-color: #b45309; --tab-bg: linear-gradient(120deg, #fcd34d, #fb923c); }
.subtab-sangrias { --tab-color: #be123c; --tab-bg: linear-gradient(120deg, #fda4af, #fb7185); }
.estoque-tab-negativo { --tab-color: #be123c; --tab-bg: linear-gradient(120deg, #fda4af, #fb7185); --tab-shadow: rgba(251, 113, 133, 0.22); }
.estoque-tab-zerado { --tab-color: #b45309; --tab-bg: linear-gradient(120deg, #fcd34d, #fb923c); --tab-shadow: rgba(251, 191, 36, 0.22); }
.estoque-tab-baixo { --tab-color: #6d28d9; --tab-bg: linear-gradient(120deg, #c4b5fd, #818cf8); --tab-shadow: rgba(167, 139, 250, 0.22); }
.estoque-tab-ok { --tab-color: #047857; --tab-bg: linear-gradient(120deg, #6ee7b7, #22d3ee); --tab-shadow: rgba(52, 211, 153, 0.22); }
.subtab small { margin-left: 4px; color: currentColor; opacity: 0.72; }
.subtab.ativa {
  color: #04121f;
  border-color: transparent;
  background: var(--tab-bg, linear-gradient(120deg, #7dd3fc, #34d399));
  box-shadow: 0 10px 24px var(--tab-shadow, rgba(56, 189, 248, 0.18));
}
.subtab-vendas { --tab-shadow: rgba(56, 189, 248, 0.22); }
.subtab-pagamentos { --tab-shadow: rgba(52, 211, 153, 0.22); }
.subtab-operadores { --tab-shadow: rgba(167, 139, 250, 0.22); }
.subtab-produtos { --tab-shadow: rgba(251, 191, 36, 0.22); }
.subtab-sangrias { --tab-shadow: rgba(251, 113, 133, 0.22); }
.tab-panel .bloco { margin-bottom: 0; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { min-width: 0; padding: 14px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
.kpi span { display: block; color: var(--muted); font-weight: 800; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.kpi strong {
  display: block;
  max-width: 100%;
  margin: 8px 0 4px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(18px, 4.6vw, 24px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
  line-height: 1.05;
}
.kpi small { font-size: 11px; }
.k-blue::before { background: var(--blue); }
.k-green::before { background: var(--green); }
.k-red::before { background: var(--red); }
.k-amber::before { background: var(--amber); }
.k-purple::before { background: var(--purple); }

.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(52px, 1fr); gap: 8px; align-items: end; min-height: 190px; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; padding-top: 6px; }
.bar { display: grid; gap: 6px; align-items: end; justify-items: center; }
.bar strong { color: #0369a1; font-size: 9.5px; line-height: 1; max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-fill { min-height: 5px; width: 100%; max-width: 30px; border-radius: 999px 999px 6px 6px; background: linear-gradient(180deg, #7dd3fc, #2563eb); }
.bar label { font-size: 10px; color: var(--muted); white-space: nowrap; }

.ranking, .list { display: grid; gap: 8px; }
.rank, .item { display: grid; gap: 6px; padding: 11px; border-radius: 14px; background: rgba(255, 255, 255, 0.54); border: 1px solid var(--line); }
.rank-line { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 13.5px; }
.meter { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(148, 163, 184, 0.16); }
.meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--blue)); }
.item { grid-template-columns: 1fr auto; align-items: center; font-size: 13.5px; }
.item small { font-size: 11px; }

.pizza-wrap { display: grid; gap: 16px; justify-items: center; }
.pizza {
  width: min(230px, 72vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.42);
}
.pizza-centro {
  width: 54%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.90);
  text-align: center;
  padding: 8px;
}
.pizza-centro strong { font-size: 17px; }
.pizza-centro span { color: var(--muted); font-size: 10px; font-weight: 900; line-height: 1.15; text-transform: uppercase; }
.pizza-legenda { width: 100%; display: grid; gap: 7px; }
.pizza-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.54);
  font-size: 12.5px;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.pizza-item.ativa { border-color: rgba(14, 165, 233, 0.56); background: rgba(224, 242, 254, 0.78); transform: translateX(2px); }
.pizza-cor { width: 10px; height: 10px; border-radius: 50%; }
.pizza-nome { font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pizza-item strong { font-size: 12.5px; }
.pizza-item small { color: var(--muted); font-weight: 900; }

.estoque-lista { display: grid; gap: 9px; }
.estoque-busca { margin-bottom: 12px; }
.estoque-busca input {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(255, 255, 255, 0.68);
}
.estoque-busca input::placeholder { color: rgba(100, 116, 139, 0.72); }
.caixa-filtro { margin-bottom: 12px; }
.financeiro-busca, .produto-busca { margin-bottom: 10px; }
.financeiro-busca input, .produto-busca input {
  border-color: rgba(56, 189, 248, 0.24);
  background: rgba(255, 255, 255, 0.68);
}
.consulta-produto { display: grid; gap: 12px; }
.consulta-ajuda { margin: -2px 0 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.consulta-produto > input {
  width: 100%;
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 13px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  outline: none;
}
.consulta-produto > input:focus { border-color: rgba(14, 165, 233, 0.72); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12); }
.consulta-produto-lista { display: grid; gap: 9px; }
.consulta-produto-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid #10b981;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.58);
}
.consulta-produto-card.sem-estoque { border-left-color: #f59e0b; }
.consulta-produto-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.consulta-produto-topo strong, .consulta-produto-topo small { display: block; }
.consulta-produto-topo strong { font-size: 13px; line-height: 1.25; }
.consulta-produto-topo small { margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.consulta-produto-topo > b { color: #047857; font-size: 10px; text-align: right; text-transform: uppercase; white-space: nowrap; }
.consulta-produto-card.sem-estoque .consulta-produto-topo > b { color: #b45309; }
.consulta-produto-dados { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.consulta-produto-dados span { min-width: 0; padding: 8px 7px; border-radius: 10px; background: rgba(224, 242, 254, 0.48); }
.consulta-produto-dados small, .consulta-produto-dados strong { display: block; }
.consulta-produto-dados small { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.consulta-produto-dados strong { margin-top: 3px; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.financeiro-cards { display: grid; gap: 10px; }
.financeiro-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #38bdf8;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}
.financeiro-card.status-vencido { border-left-color: #e11d48; }
.financeiro-card.status-recebido, .financeiro-card.status-pago { border-left-color: #10b981; }
.financeiro-card.status-aberto { border-left-color: #f59e0b; }
.financeiro-card-topo {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.financeiro-card-topo strong {
  min-width: 0;
  color: #047857;
  font-size: 13px;
  line-height: 1.25;
}
.financeiro-card-topo span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #0f172a;
  background: rgba(125, 211, 252, 0.42);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.financeiro-card-linha {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.financeiro-card-linha b { color: var(--text); font-weight: 800; text-align: right; }
.financeiro-card-valores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.financeiro-card-valores div {
  min-width: 0;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}
.financeiro-card small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.financeiro-card-valores b {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: #b45309;
  font-size: 12.5px;
  line-height: 1.12;
}
.financeiro-card-valores div:nth-child(2) b { color: #e11d48; }
.financeiro-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.financeiro-lista .table {
  width: max-content;
  min-width: 760px;
  table-layout: auto;
}
.financeiro-lista .table th,
.financeiro-lista .table td {
  width: auto;
  min-width: 104px;
  overflow: visible;
  text-overflow: clip;
}
.financeiro-lista .table th:first-child,
.financeiro-lista .table td:first-child {
  min-width: 210px;
  max-width: 260px;
  white-space: normal;
  line-height: 1.25;
}
.financeiro-lista .table th:nth-child(2),
.financeiro-lista .table td:nth-child(2) { min-width: 96px; }
.financeiro-lista .table th:nth-child(6),
.financeiro-lista .table td:nth-child(6) { min-width: 110px; }
.comissao-config { margin-bottom: 12px; }
.comissao-config label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--branco);
  font-size: 14px;
  font-weight: 850;
  text-shadow: 0 1px 2px rgba(36, 19, 13, 0.45);
}
.comissao-config input {
  width: 92px;
  min-height: 34px;
  border: 1px solid rgba(214, 166, 117, 0.7);
  border-radius: 10px;
  padding: 6px 9px;
  color: #24130d;
  background: var(--branco);
  font: inherit;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(36, 19, 13, 0.18);
}
.comissao-config input:focus {
  outline: none;
  border-color: var(--ouro);
  box-shadow: 0 0 0 3px rgba(214, 166, 117, 0.22), 0 8px 18px rgba(36, 19, 13, 0.18);
}
.comissao-cards { display: grid; gap: 10px; }
.comissao-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #10b981;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}
.comissao-card-topo {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.comissao-card-topo strong {
  min-width: 0;
  color: #047857;
  font-size: 13px;
  line-height: 1.25;
}
.comissao-card-topo span {
  flex: 0 0 auto;
  color: #b45309;
  font-size: 13px;
  font-weight: 950;
}
.comissao-card p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}
.comissao-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.comissao-card-meta small {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 10.5px;
  font-weight: 850;
}
.status-filtros {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.status-filtros::-webkit-scrollbar { display: none; }
.status-filtros button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font: inherit;
  font-size: 11.5px;
  font-weight: 900;
}
.status-filtros button.ativa {
  color: #04121f;
  border-color: transparent;
  background: linear-gradient(120deg, #7dd3fc, #34d399);
}
.paginacao {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.paginacao button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.58);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}
.paginacao button:disabled { opacity: 0.38; }
.paginacao span { color: var(--muted); text-align: center; font-size: 12px; font-weight: 800; }
.estoque-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--estoque-cor, var(--blue));
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
}
.estoque-item strong { display: block; font-size: 13px; line-height: 1.25; }
.estoque-item span { display: block; margin-top: 5px; color: var(--estoque-cor, var(--muted)); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.estoque-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.estoque-precos { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; }
.estoque-precos small { margin-top: 0; font-size: 10px; }
.estoque-precos b { color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.estoque-saldo { display: grid; justify-items: end; gap: 3px; min-width: 72px; }
.estoque-saldo b { color: var(--estoque-cor, var(--text)); font-size: 18px; font-variant-numeric: tabular-nums; }
.estoque-saldo em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 900; text-transform: uppercase; }
.estoque-negativo { --estoque-cor: #fb7185; }
.estoque-zerado { --estoque-cor: #fbbf24; }
.estoque-baixo { --estoque-cor: #a78bfa; }
.estoque-ok { --estoque-cor: #34d399; }

.table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.table th, .table td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child, .table td:first-child { width: auto; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.table th:not(:first-child), .table td:not(:first-child) { width: 86px; }
.table th.td-col-qtd, .table td.td-col-qtd { width: 64px; }
.table th.td-col-custo, .table td.td-col-custo { width: 74px; }
.table th.td-col-margem, .table td.td-col-margem { width: 74px; }
.table th { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.table td.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.table td.td-data { color: #0369a1; font-weight: 800; }
.table td.td-operador { color: #047857; font-weight: 900; }
.table td.td-valor { color: #b45309; font-weight: 950; }
.table td.td-obs { color: #be123c; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }

.alertas-lista { display: grid; gap: 10px; }
.alerta-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(225, 29, 72, 0.18);
  border-left: 4px solid #e11d48;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}
.alerta-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.alerta-tipo {
  min-width: 0;
  overflow: hidden;
  color: #e11d48;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerta-topo strong {
  flex: 0 0 auto;
  color: #047857;
  font-size: 12px;
  font-weight: 950;
  text-align: right;
}
.alerta-item p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}
.alerta-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.alerta-meta span {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  color: #b45309;
  background: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 950;
}
.alerta-meta small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 420px) {
  .kpis { gap: 8px; }
  .kpi { padding: 13px 12px; }
  .kpi span { font-size: 9.5px; letter-spacing: 0.04em; }
  .kpi strong { font-size: clamp(17px, 6vw, 22px); }
  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 5px; }
  .table th:not(:first-child), .table td:not(:first-child) { width: 78px; }
  .table th.td-col-qtd, .table td.td-col-qtd { width: 56px; }
  .table th.td-col-custo, .table td.td-col-custo { width: 66px; }
  .table th.td-col-margem, .table td.td-col-margem { width: 58px; }
}

.vazio { padding: 18px 4px; text-align: center; color: var(--muted); font-size: 13px; }

.carregando { opacity: 0.55; transition: opacity 0.15s; }

.perfil { padding: 26px 20px; text-align: center; display: grid; gap: 4px; justify-items: center; }
.perfil-avatar {
  width: 72px; height: 72px;
  display: grid; place-items: center;
  border-radius: 24px;
  font-size: 24px; font-weight: 900; color: #04121f;
  background: linear-gradient(135deg, #7dd3fc, #a78bfa);
  margin-bottom: 10px;
}

/* --------- BARRA INFERIOR (fixa, rolavel no eixo) --------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-top: 0;
  padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(239, 246, 255, 0.94));
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 28px rgba(12, 69, 88, 0.16);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar .tab {
  flex: 1 0 76px;
  min-width: 76px;
  min-height: 46px;
}
.tab {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding: 7px 2px;
  border-radius: 14px;
  cursor: pointer;
}
.tab svg { width: 21px; height: 21px; }
.tab span { font-size: 10px; font-weight: 700; }
.tab.ativa { color: var(--blue); background: rgba(56, 189, 248, 0.12); }

/* Reserva espaco para a barra fixa nao cobrir o conteudo. */
.app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

@media (min-width: 520px) {
  .grade-modulos { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .tabbar .tab { flex: 1 0 0; min-width: 0; }
}
