:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #eef2f6;
  --card: #ffffff;
  --teal: #0f766e;
  --teal-2: #115e59;
  --teal-soft: #ccfbf1;
  --rose: #e11d48;
  --emerald: #059669;
  --amber: #d97706;
  --violet: #7c3aed;
  --safe-top: env(safe-area-inset-top);
  --safe-bot: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: #dbe4ee;
  color: var(--ink);
}
#root { min-height: 100%; display: grid; place-items: start center; }
.app {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #f6f8fb;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.install-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #ecfeff;
  border: 1px solid #99f6e4;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.45;
  color: #115e59;
  flex-shrink: 0;
}
.install-hint p { margin: 0; }
.install-hint-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.install-hint-full,
.install-hint-close {
  border: 0;
  border-radius: 10px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.install-hint-full {
  background: #115e59;
  color: #fff;
}
.install-hint-close {
  background: #e8eef3;
  color: var(--ink);
}
.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: calc(10px + var(--safe-top)) 18px 12px;
}
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.hello { font-size: 13px; color: var(--muted); }
.hello-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.conn-link {
  border: 0;
  background: #e8eef3;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  color: var(--ink);
}
.token-link {
  border: 1px solid var(--line);
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--teal);
  padding: 0;
  font-family: inherit;
}
.token-link svg {
  width: 16px;
  height: 16px;
}
.title { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; margin-top: 0; }
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  width: 40px; height: 40px;
  border-radius: 14px;
  font-size: 18px;
  display: grid; place-items: center;
  cursor: pointer;
}
.period {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
}
.btn-go {
  border: 0;
  background: var(--teal);
  color: #fff;
  border-radius: 12px;
  height: 42px;
  padding: 0 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.hero {
  margin-top: 10px;
  background: linear-gradient(160deg, #115e59, #0f766e 55%, #134e4a);
  color: #fff;
  border-radius: 22px;
  padding: 18px 16px;
}
.hero .lbl { font-size: 12px; opacity: 0.82; }
.hero .val { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; margin-top: 4px; }
.hero .sub { font-size: 12px; opacity: 0.78; margin-top: 4px; }
.hero-tall { padding: 20px 16px 18px; }
.hero-tall .val { font-size: 30px; }
.hero-pracas {
  margin-top: 10px;
  background: #e8eef3;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 8px 10px;
}
.hero-pracas .pracas-mini {
  margin-top: 0;
  gap: 8px;
}
.hero-pracas .kpi {
  padding: 7px 9px;
  border-radius: 12px;
}
.hero-pracas .kpi b {
  font-size: 13px;
  margin-top: 1px;
  line-height: 1.2;
}
.hero-pracas .kpi small {
  font-size: 9px;
  margin-top: 1px;
  line-height: 1.25;
}
.hero-pracas .praca-var {
  display: block;
  font-size: 9px;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.2;
}
.hero-pracas .praca-var.pos { color: var(--emerald); }
.hero-pracas .praca-var.neg { color: var(--rose); }
.table-wrap-tight { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pracas { margin-top: 14px; }
.kpi {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 10px;
}
.kpi b { display: block; font-size: 15px; margin-top: 3px; }
.kpi span { font-size: 10px; opacity: 0.8; font-weight: 600; }
.praca-lbl { font-size: 11px; font-weight: 700; }
.kpi small { display: block; font-size: 10px; margin-top: 2px; font-weight: 600; }
.hero .kpi.kpi-mg,
.hero-pracas .kpi.kpi-mg {
  background: #ffedd5;
  border-color: #fb923c;
  color: var(--amber);
}
.hero .kpi.kpi-mg .praca-lbl,
.hero .kpi.kpi-mg b,
.hero .kpi.kpi-mg small,
.hero-pracas .kpi.kpi-mg .praca-lbl,
.hero-pracas .kpi.kpi-mg b,
.hero-pracas .kpi.kpi-mg small {
  color: #c2410c;
  opacity: 1;
}
.hero .kpi.kpi-df,
.hero-pracas .kpi.kpi-df {
  background: #dbeafe;
  border-color: #38bdf8;
  color: #0284c7;
}
.hero .kpi.kpi-df .praca-lbl,
.hero .kpi.kpi-df b,
.hero .kpi.kpi-df small,
.hero-pracas .kpi.kpi-df .praca-lbl,
.hero-pracas .kpi.kpi-df b,
.hero-pracas .kpi.kpi-df small {
  color: #0369a1;
  opacity: 1;
}
.section { margin-top: 18px; font-size: 13px; font-weight: 700; }
.table-wrap {
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
.lojas-table {
  width: max-content;
  max-width: 100%;
  table-layout: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.lojas-table col.c-loja { width: 2.4rem; }
.lojas-table col.c-venda { width: auto; }
.lojas-table col.c-pct { width: auto; }
.lojas-table col.c-var { width: auto; }
.lojas-table th,
.lojas-table td {
  padding: 7px 3px;
}
.lojas-table th:first-child,
.lojas-table td:first-child {
  padding-left: 10px;
  padding-right: 0;
}
.lojas-table th:nth-child(2),
.lojas-table td:nth-child(2) {
  padding-left: 0;
}
.lojas-table th:last-child,
.lojas-table td:last-child {
  padding-right: 10px;
}
.lojas-table .col-money {
  padding-left: 2px;
  padding-right: 3px;
}
.lojas-table .col-pct {
  padding-left: 2px;
  padding-right: 3px;
}
.lojas-table .col-var {
  padding-left: 3px;
  padding-right: 8px;
}
th, td { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }
.lojas-table th:first-child { z-index: 2; }
th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 700; background: #f0fdfa; }
tr.total td:first-child { color: var(--ink); }
.pos { color: var(--emerald); font-weight: 700; }
.neg { color: var(--rose); font-weight: 700; }
td.uf-mg { color: var(--amber); font-weight: 700; }
td.uf-df { color: #0284c7; font-weight: 700; }
th.th-sort {
  cursor: pointer;
  user-select: none;
  color: var(--teal-2) !important;
  background: #f0fdfa;
}
th.th-sort .hint {
  font-size: 9px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
  display: block;
  margin-top: 2px;
}
th.th-sort-on {
  color: var(--teal-2) !important;
  background: #ecfdf5;
}
th.th-sort .hint:empty {
  display: none;
}
.chart-card {
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}
.chart-card h3 { font-size: 13px; margin-bottom: 8px; }
.chart-box { height: 220px; position: relative; }
.tabs {
  position: relative;
  left: auto;
  transform: none;
  width: auto;
  margin: 0 12px calc(12px + var(--safe-bot));
  flex-shrink: 0;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--line);
  border-radius: 22px;
  height: 62px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 6px;
  z-index: 6;
}
.tab {
  border: 0;
  background: transparent;
  border-radius: 16px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
}
.tab.on { background: var(--teal-soft); color: var(--teal-2); }
.tab.disabled { opacity: 0.45; }
.sheet {
  position: fixed;
  inset: 0;
  left: 50%;
  transform: translateX(-50%) translateY(104%);
  width: min(430px, 100%);
  background: #f6f8fb;
  z-index: 10;
  display: flex;
  flex-direction: column;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-head {
  padding: calc(20px + var(--safe-top)) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 { font-size: 20px; letter-spacing: -0.03em; }
.ghost {
  border: 0; background: #e8eef3; width: 34px; height: 34px;
  border-radius: 50%; font-size: 18px; color: var(--ink); cursor: pointer;
}
.sheet-body { flex: 1; overflow: auto; padding: 4px 18px 16px; }
.save {
  margin: 8px 18px calc(18px + var(--safe-bot));
  border: 0; background: var(--teal); color: #fff; border-radius: 16px;
  height: 50px; font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(382px, calc(100% - 48px));
  bottom: calc(78px + var(--safe-bot));
  background: var(--ink); color: #fff; border-radius: 14px;
  padding: 12px 14px; font-size: 13px; font-weight: 600; z-index: 12;
  text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
.setup { padding: calc(28px + var(--safe-top)) 22px 32px; min-height: 100dvh; }
.setup h1 { font-size: 28px; letter-spacing: -0.03em; }
.setup p { color: var(--muted); margin-top: 8px; line-height: 1.5; font-size: 14px; }
.setup-hint { font-size: 13px; color: var(--teal-2); margin-top: 14px; }
.empty { text-align: center; color: var(--muted); margin-top: 36px; font-size: 14px; line-height: 1.5; }
.error { color: var(--rose); font-size: 13px; margin-top: 10px; }
.busy { opacity: 0.6; pointer-events: none; }
.hidden { display: none !important; }
.placeholder-tab { padding: 40px 18px; text-align: center; color: var(--muted); }
.coming-soon {
  margin-top: 12px;
  display: grid;
  place-items: center;
  min-height: 0;
  padding-bottom: 8px;
}
.coming-soon-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 18px 26px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.coming-soon-art,
.coming-soon-svg {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
}
.coming-soon-card h2 {
  margin-top: 18px;
  font-size: 22px;
  letter-spacing: -0.03em;
}
.coming-soon-msg {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.token-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #f6f8fb;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.token-screen.open {
  transform: translateY(0);
  pointer-events: auto;
}
.token-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 18px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.token-back {
  border: 0;
  background: #e8eef3;
  color: var(--teal-2);
  font-size: 20px;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}
.token-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--teal);
}
.token-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding: 8px 24px calc(16px + var(--safe-bot));
}
.token-info {
  width: 100%;
  text-align: center;
  flex-shrink: 0;
}
.token-ring-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}
.token-user {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
  color: var(--ink);
}
.token-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.token-ring-wrap {
  position: relative;
  width: min(240px, 68vw);
  aspect-ratio: 1;
  margin: 0;
}
.token-ring {
  width: 100%;
  height: 100%;
}
.token-ring-bg {
  fill: none;
  stroke: var(--teal-soft);
  stroke-width: 7;
}
.token-ring-progress {
  fill: none;
  stroke: var(--teal);
  stroke-width: 7;
  stroke-linecap: round;
}
.token-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 12px;
}
.token-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.token-code {
  font-size: clamp(22px, 5.8vw, 28px);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
  color: var(--teal-2);
}
.token-countdown {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.token-foot {
  flex-shrink: 0;
  padding-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
