:root {
  /* Tema claro profissional — ZForcePay */
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f1f4f7;
  --surface-3: #e9eef2;
  --border: #e2e8ee;
  --border-2: #d4dce4;
  --text: #16241d;
  --text-2: #38444e;
  --muted: #647281;
  --muted-2: #9aa6b2;
  --brand: #146e37;        /* verde escuro */
  --brand-2: #1c8a48;      /* hover */
  --brand-3: #0f5a2c;      /* pressed */
  --accent: #64c832;       /* verde-limão (uso pontual) */
  --brand-soft: #e7f2ea;
  --brand-soft-2: #d8ecde;
  --danger: #d92d4b;
  --danger-soft: #fceaed;
  --warn: #b76e00;
  --warn-soft: #fbf0dd;
  --info: #2563eb;
  --info-soft: #e8effd;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand .logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--brand-soft);
  display: grid; place-items: center; flex-shrink: 0;
}
.brand .logo img { width: 26px; height: 26px; }
.brand .name { font-weight: 700; font-size: 15.5px; letter-spacing: -0.2px; line-height: 1.1; }
.brand .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); padding: 14px 12px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: var(--text-2);
  font-weight: 600; font-size: 13.5px; transition: all .15s; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-item .ico { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; opacity: .9; flex-shrink: 0; }
.nav-item.active .ico { opacity: 1; }
svg { vertical-align: middle; }
.kpi .icon svg, .feed-item .ic svg { display: block; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--brand); }
.dot.off { background: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); z-index: 40;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -0.3px; white-space: nowrap; }
.topbar .spacer { flex: 1; min-width: 8px; }

.hamburger { display: none; background: var(--surface); border: 1px solid var(--border); width: 38px; height: 38px; border-radius: 10px; font-size: 18px; align-items: center; justify-content: center; color: var(--text); }

.ranges { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; border: 1px solid var(--border); }
.ranges button { background: transparent; border: none; color: var(--muted); padding: 6px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ranges button:hover { color: var(--text); }
.ranges button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); color: #fff; }
.btn.ghost { background: transparent; }
.btn .spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.content { padding: 22px 24px 60px; max-width: 1480px; width: 100%; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0;
}
.card.pad-lg { padding: 22px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 27px; font-weight: 800; margin: 10px 0 6px; letter-spacing: -1px; color: var(--text); }
.kpi .delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--brand); }
.delta.down { color: var(--danger); }
.delta .muted { color: var(--muted-2); font-weight: 500; }
.kpi .icon { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 17px; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .hint { font-size: 12px; color: var(--muted); white-space: nowrap; }

.row-2 { grid-template-columns: 1.6fr 1fr; }
.row-2b { grid-template-columns: 1fr 1fr; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td b { color: var(--text); }
.mono { font-family: 'SF Mono', ui-monospace, 'Cascadia Code', monospace; font-size: 12px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.green { background: var(--brand-soft); color: var(--brand); }
.badge.gray { background: var(--surface-3); color: var(--muted); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--info-soft); color: var(--info); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--brand); flex-shrink: 0; }

/* ---------- Feed ---------- */
.feed-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border: none; }
.feed-item .ic { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; font-size: 14px; }
.feed-item .meta { flex: 1; min-width: 0; }
.feed-item .meta .t { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.feed-item .meta .s { color: var(--muted); font-size: 11.5px; }
.feed-item .val { font-weight: 800; color: var(--brand); white-space: nowrap; }

/* ---------- Heatmap ---------- */
.heatmap-scroll { overflow-x: auto; }
.heatmap { display: grid; grid-template-columns: 36px repeat(24, minmax(20px, 1fr)); gap: 3px; font-size: 10px; min-width: 560px; }
.heatmap .h-cell { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.heatmap .h-label { color: var(--muted-2); display: grid; place-items: center; background: transparent; font-weight: 600; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.search { background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 14px; color: var(--text); width: 240px; max-width: 40vw; font-size: 13px; }
.search:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search::placeholder { color: var(--muted-2); }
.input { background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 12px; color: var(--text); font-size: 13px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 12px; }
.pagination { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.note { background: var(--brand-soft); border: 1px solid var(--brand-soft-2); border-radius: 10px; padding: 14px 16px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.note.warn { background: var(--warn-soft); border-color: #f0dcb8; }
.note a { color: var(--brand); font-weight: 600; }
.chart-box { position: relative; height: 280px; width: 100%; }
.chart-box.sm { height: 230px; }
code.snippet { display: block; background: #0f1c14; border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-family: ui-monospace, monospace; font-size: 12px; color: #7ee0a0; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
#map { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 1; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); border: none; color: #fff; padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 100; font-weight: 600; font-size: 13px; animation: slideup .3s; max-width: calc(100vw - 48px); }
.toast.success { background: var(--brand); }
.toast.error { background: var(--danger); }
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border-2); border-radius: 24px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.overlay { display: none; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 45; }

/* ---------- Login ---------- */
#login-screen { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #0f5a2c 0%, #146e37 50%, #1c8a48 100%); }
.login-card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; padding: 32px 28px; text-align: center; }
.login-card .login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; margin: 0 auto 16px; }
.login-card .login-logo img { width: 36px; height: 36px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.login-card > p { margin: 0 0 20px; font-size: 13px; }
.login-card .field { text-align: left; }
.login-card .input { width: 100%; padding: 11px 13px; }
.login-card .err { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Cards de chave (Por Chave PIX) ---------- */
.keycards { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.keycard { cursor: pointer; transition: all .15s; padding: 16px; }
.keycard:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.keycard.sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.keycard .icon { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.keycard .label { font-size: 12px; font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 11px 14px; font-size: 13.5px; font-weight: 600; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab svg { opacity: .85; }
h4 { font-size: 14px; font-weight: 700; color: var(--text); }

/* ---------- Caixa de usuário (sidebar) ---------- */
.user-box { display: flex; align-items: center; gap: 10px; }
.user-box .avatar { width: 34px; height: 34px; }
#seller-filter select { font-size: 12.5px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head .close { background: none; border: none; color: var(--muted); display: flex; padding: 4px; border-radius: 8px; }
.modal-head .close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field .input, .field select { width: 100%; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23647281' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-box { text-align: center; padding: 10px; }
.qr-box canvas, .qr-box img { margin: 0 auto; border-radius: 12px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, 1fr); } .row-2, .row-2b { grid-template-columns: 1fr; } }
@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; }
  .hamburger { display: inline-flex; }
}
@media (max-width: 720px) {
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 16px; }
  .search { display: none; }
  .ranges button { padding: 6px 9px; font-size: 12px; }
  .btn-label { display: none; }
}
@media (max-width: 460px) { .kpis { grid-template-columns: 1fr; } }
