/* ============================================================
   Design System - Bot de Recarga
   ============================================================ */
:root {
  /* Cores */
  --bg: #0a0e1a;
  --bg-2: #0f1629;
  --panel: #131a2e;
  --panel-2: #1a2240;
  --border: #1f2937;
  --border-strong: #334155;

  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --muted-2: #64748b;

  --primary: #3b82f6;
  --primary-2: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.12);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);

  --purple: #8b5cf6;
  --purple-soft: rgba(139, 92, 246, 0.12);

  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.12);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body.nav-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

code, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }

button, .btn {
  background: var(--primary); color: #fff;
  border: 0; padding: 9px 14px;
  border-radius: var(--radius);
  cursor: pointer; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
  transition: all .15s ease;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--primary-2); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { background: var(--muted-2); cursor: not-allowed; opacity: 0.6; transform: none; }

button.danger, .btn.danger { background: var(--danger); }
button.danger:hover { background: #dc2626; }
button.success, .btn.success { background: var(--success); }
button.success:hover { background: #059669; }
button.warning, .btn.warning { background: var(--warning); color: #1f2937; }
button.ghost, .btn.ghost {
  background: transparent; border: 1px solid var(--border-strong); color: var(--text-2);
}
button.ghost:hover { background: var(--panel); border-color: var(--primary); color: var(--text); }
button.icon { padding: 8px; min-width: 34px; }

input, select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input::placeholder { color: var(--muted-2); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }

.field { margin-bottom: 14px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ============================================================
   Layout principal
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ===== Sidebar ===== */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px;
  font-weight: 800; font-size: 17px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sidebar .brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-weight: 900;
  flex-shrink: 0;
}
.sidebar .brand .text { opacity: 1; transition: opacity .15s; }
.app.collapsed .sidebar .brand .text { opacity: 0; pointer-events: none; }

.sidebar .nav {
  flex: 1; padding: 12px 10px; overflow-y: auto;
}
.sidebar .nav::-webkit-scrollbar { width: 6px; }
.sidebar .nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.sidebar .group-label {
  font-size: 11px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 12px 6px; font-weight: 700;
}
.app.collapsed .sidebar .group-label {
  height: 0; padding: 0; overflow: hidden; visibility: hidden;
}

.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-2); font-weight: 500;
  cursor: pointer; user-select: none;
  margin-bottom: 2px;
  position: relative;
  transition: all .12s ease;
  white-space: nowrap;
}
.sidebar .nav-item .ico {
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--muted);
}
.sidebar .nav-item:hover {
  background: var(--panel-2); color: var(--text);
}
.sidebar .nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.sidebar .nav-item.active .ico { color: var(--primary); }
.sidebar .nav-item .label { opacity: 1; transition: opacity .15s; }
.app.collapsed .sidebar .nav-item .label { opacity: 0; pointer-events: none; }
.app.collapsed .sidebar .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .sidebar .nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; background: var(--primary); border-radius: 2px;
}
.sidebar .nav-item .badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 999px; font-weight: 700;
}
.app.collapsed .sidebar .nav-item .badge { display: none; }

.sidebar .footer {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .footer .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--primary));
  display: grid; place-items: center; color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.sidebar .footer .info { line-height: 1.2; opacity: 1; transition: opacity .15s; }
.app.collapsed .sidebar .footer .info { opacity: 0; pointer-events: none; }
.sidebar .footer .info .name { font-weight: 600; font-size: 13px; }
.sidebar .footer .info .role { color: var(--muted); font-size: 11px; text-transform: uppercase; }

/* ===== Main ===== */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .burger {
  background: transparent; border: 0; padding: 0;
  color: var(--muted); border-radius: var(--radius);
  cursor: pointer;
  display: grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
}
.topbar .burger svg { pointer-events: none; display: block; }
.topbar .burger:hover { background: var(--panel-2); color: var(--text); }
.topbar .page-title { font-weight: 700; font-size: 16px; margin-right: 12px; }

.search-trigger {
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); cursor: pointer; font-size: 13px;
  min-width: 240px;
}
.search-trigger:hover { border-color: var(--primary); }
.search-trigger .kbd {
  margin-left: auto;
  background: var(--panel); padding: 2px 6px; border-radius: 4px;
  font-size: 11px; font-family: var(--font-mono);
  border: 1px solid var(--border-strong);
}

.topbar .spacer { flex: 1; }

.iconbtn {
  background: transparent; border: 0; color: var(--muted);
  padding: 8px; border-radius: var(--radius); position: relative;
}
.iconbtn:hover { background: var(--panel-2); color: var(--text); }
.iconbtn .badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 999px;
  font-weight: 700; min-width: 18px; text-align: center;
  border: 2px solid var(--panel);
}
.iconbtn .badge:empty { display: none; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  min-width: 320px; max-height: 460px;
  box-shadow: var(--shadow);
  display: none; flex-direction: column;
  z-index: 100; overflow: hidden;
}
.dropdown-menu.show { display: flex; animation: slideDown .15s ease-out; }
@keyframes slideDown { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.dropdown-menu .head {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 14px;
}
.dropdown-menu .body { overflow-y: auto; flex: 1; }
.dropdown-menu .body::-webkit-scrollbar { width: 6px; }
.dropdown-menu .body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.dropdown-menu .item {
  padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer; border-bottom: 1px solid var(--border);
}
.dropdown-menu .item:last-child { border-bottom: 0; }
.dropdown-menu .item:hover { background: var(--panel-2); }
.dropdown-menu .item .ico { color: var(--primary); margin-top: 2px; }
.dropdown-menu .item .text .title { font-weight: 600; font-size: 13px; }
.dropdown-menu .item .text .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dropdown-menu .empty { padding: 24px; text-align: center; color: var(--muted); }

/* ===== Content area ===== */
.content { flex: 1; padding: 24px; overflow-x: auto; }
.content h2.page-h {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.content h2.page-h .sub { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ============================================================
   Componentes
   ============================================================ */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}
.card .card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.card .card-head h3 { margin: 0; flex: 1; }
.card .card-head .actions { display: flex; gap: 6px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cards-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

/* ===== KPI Card ===== */
.kpi {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px; position: relative; overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 6px; line-height: 1.1; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.kpi .sub .delta.up { color: var(--success); }
.kpi .sub .delta.down { color: var(--danger); }
.kpi .ico-bg {
  position: absolute; right: -8px; top: -8px;
  width: 60px; height: 60px;
  border-radius: 16px;
  display: grid; place-items: center;
  opacity: 0.15;
}
.kpi.blue { border-top: 2px solid var(--primary); }
.kpi.blue .ico-bg { background: var(--primary); color: #fff; }
.kpi.green { border-top: 2px solid var(--success); }
.kpi.green .ico-bg { background: var(--success); color: #fff; }
.kpi.purple { border-top: 2px solid var(--purple); }
.kpi.purple .ico-bg { background: var(--purple); color: #fff; }
.kpi.amber { border-top: 2px solid var(--warning); }
.kpi.amber .ico-bg { background: var(--warning); color: #fff; }
.kpi .sparkline { margin-top: 10px; height: 36px; }

/* ===== Tabela ===== */
.table-wrap {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-toolbar input.search { max-width: 280px; }
.table-toolbar select { max-width: 180px; }
.table-toolbar .spacer { flex: 1; }
.table-toolbar .info { color: var(--muted); font-size: 13px; }

table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  background: var(--bg-2); color: var(--muted); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  position: sticky; top: 0; z-index: 1;
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
th .sort-ind { font-size: 10px; opacity: 0.6; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr.selected { background: var(--primary-soft); }

td .row-actions { display: flex; gap: 4px; opacity: 0.5; transition: opacity .1s; }
tbody tr:hover .row-actions { opacity: 1; }

.pagination {
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
}
.pagination .info { color: var(--muted); font-size: 13px; flex: 1; }
.pagination .pages { display: flex; gap: 4px; }
.pagination button { padding: 6px 10px; min-width: 36px; }
.pagination button.active { background: var(--primary); }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em;
}
.badge.pendente { background: var(--warning-soft); color: var(--warning); }
.badge.pago, .badge.paga { background: var(--primary-soft); color: var(--primary); }
.badge.concluido, .badge.ativo { background: var(--success-soft); color: var(--success); }
.badge.cancelado, .badge.bloqueado, .badge.erro, .badge.expirado { background: var(--danger-soft); color: var(--danger); }
.badge.processando, .badge.inativo { background: rgba(148,163,184,.15); color: var(--muted); }
.badge.pix_gerado { background: var(--cyan-soft); color: var(--cyan); }
.badge.estorno { background: var(--purple-soft); color: var(--purple); }
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ===== Avatar ===== */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--primary));
  color: #fff; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-backdrop.show { display: flex; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  width: 100%; max-width: 520px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease-out;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal.lg { max-width: 720px; }
.modal.xl { max-width: 920px; }
.modal .head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal .head h2 { margin: 0; flex: 1; font-size: 17px; }
.modal .head .close {
  background: transparent; border: 0; color: var(--muted); padding: 4px;
}
.modal .head .close:hover { color: var(--text); background: var(--panel-2); }
.modal .body { padding: 20px; overflow-y: auto; flex: 1; }
.modal .foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}
.modal .foot .spacer { flex: 1; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 76px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--primary);
  padding: 12px 16px; border-radius: var(--radius);
  min-width: 280px; max-width: 380px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .2s ease-out;
  pointer-events: auto;
}
.toast .ico { color: var(--primary); }
.toast.success { border-left-color: var(--success); }
.toast.success .ico { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error .ico { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning .ico { color: var(--warning); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Heatmap ===== */
.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 14px 0;
}
.heatmap {
  display: grid;
  grid-template-columns: 28px repeat(24, 1fr);
  gap: 2px;
  font-size: 10px;
  min-width: 560px;
}
.heatmap .hm-label {
  color: var(--muted); text-align: center; padding: 2px 0;
}
.heatmap .hm-cell {
  aspect-ratio: 1;
  background: var(--panel-2); border-radius: 3px;
  position: relative;
  cursor: default;
}
.heatmap .hm-cell:hover { outline: 2px solid var(--primary); }
.heatmap .hm-cell[data-level="0"] { background: var(--panel-2); }
.heatmap .hm-cell[data-level="1"] { background: rgba(59,130,246,.25); }
.heatmap .hm-cell[data-level="2"] { background: rgba(59,130,246,.45); }
.heatmap .hm-cell[data-level="3"] { background: rgba(59,130,246,.7); }
.heatmap .hm-cell[data-level="4"] { background: rgba(59,130,246,.95); }

/* ===== Timeline ===== */
.timeline {
  display: flex; flex-direction: column;
  padding-left: 24px;
  position: relative;
}
.timeline::before {
  content: ''; position: absolute;
  left: 8px; top: 4px; bottom: 4px; width: 2px;
  background: var(--border-strong);
}
.timeline-item {
  position: relative;
  padding-bottom: 16px;
}
.timeline-item::before {
  content: ''; position: absolute;
  left: -20px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--border-strong);
}
.timeline-item.done::before { background: var(--success); border-color: var(--success); }
.timeline-item.now::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline-item .ts { font-size: 11px; color: var(--muted); }
.timeline-item .title { font-weight: 600; font-size: 14px; margin: 2px 0; }
.timeline-item .desc { font-size: 13px; color: var(--muted); }

/* ===== Login split ===== */
.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.login-split .hero {
  background:
    radial-gradient(circle at 30% 20%, rgba(139,92,246,.3), transparent 60%),
    radial-gradient(circle at 80% 60%, rgba(59,130,246,.3), transparent 50%),
    var(--bg-2);
  padding: 60px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.login-split .hero h1 { font-size: 36px; line-height: 1.1; }
.login-split .hero .tag { color: var(--muted); font-size: 16px; margin-top: 14px; max-width: 380px; }
.login-split .hero .feat { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.login-split .hero .feat div { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.login-split .hero .feat div .ico { color: var(--success); }
.login-split .form-side {
  display: grid; place-items: center;
  padding: 40px;
}
.login-split .form-card {
  width: 100%; max-width: 360px;
}
.login-split .form-card .title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.login-split .form-card .sub { color: var(--muted); margin-bottom: 22px; }
.login-split .demo-hint {
  background: var(--primary-soft); border: 1px dashed var(--primary);
  border-radius: var(--radius); padding: 10px 12px;
  font-size: 12px; color: var(--text-2);
  margin-top: 16px;
  line-height: 1.6;
}
.login-split .demo-hint b { color: var(--text); }
@media (max-width: 800px) {
  .login-split { grid-template-columns: 1fr; }
  .login-split .hero { display: none; }
}

/* ===== Cmd-K search ===== */
.cmdk {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 14vh; z-index: 999; padding-left: 20px; padding-right: 20px;
}
.cmdk.show { display: flex; animation: fadeIn .1s; }
.cmdk .cmdk-box {
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); width: 100%; max-width: 580px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: slideUp .15s;
}
.cmdk input {
  border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 16px 18px;
  font-size: 16px; background: transparent;
}
.cmdk input:focus { box-shadow: none; }
.cmdk .results { max-height: 50vh; overflow-y: auto; }
.cmdk .group {
  padding: 8px 18px 4px;
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  font-weight: 700; letter-spacing: .04em;
}
.cmdk .item {
  padding: 10px 18px; display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.cmdk .item:hover, .cmdk .item.active { background: var(--panel-2); }
.cmdk .item .ico { color: var(--muted); }
.cmdk .item .text { flex: 1; }
.cmdk .item .text .title { font-weight: 600; font-size: 14px; }
.cmdk .item .text .sub { color: var(--muted); font-size: 12px; }
.cmdk .empty { padding: 30px; text-align: center; color: var(--muted); }

/* ===== Misc ===== */
.empty-state {
  padding: 60px 20px; text-align: center; color: var(--muted);
}
.empty-state .ico { font-size: 36px; margin-bottom: 10px; opacity: 0.6; }
.empty-state .title { color: var(--text-2); font-weight: 600; margin-bottom: 4px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--panel-2); color: var(--text-2);
}
.chip.primary { background: var(--primary-soft); color: var(--primary); }
.chip.success { background: var(--success-soft); color: var(--success); }

.code-block {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  font-family: var(--font-mono); font-size: 12px;
  word-break: break-all; color: var(--text-2);
  position: relative;
}
.code-block .copy {
  position: absolute; top: 6px; right: 6px;
  padding: 4px 8px; font-size: 11px;
}

.qr-block {
  background: #fff; border-radius: var(--radius);
  padding: 12px; display: inline-block;
}
.qr-block img { display: block; width: 180px; height: 180px; }

/* Operadora card */
.op-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all .15s; cursor: pointer;
}
.op-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.op-card .head { display: flex; align-items: center; gap: 12px; }
.op-card .logo {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.op-card .logo.viv { background: linear-gradient(135deg, #660099, #9933cc); }
.op-card .logo.cla { background: linear-gradient(135deg, #e30613, #ff4d4d); }
.op-card .logo.tim { background: linear-gradient(135deg, #003a70, #0066cc); }
.op-card .logo.oi  { background: linear-gradient(135deg, #ffcc00, #ff9900); color: #1f2937; }
.op-card .logo.def { background: linear-gradient(135deg, var(--purple), var(--primary)); }
.op-card .name { font-weight: 700; font-size: 16px; }
.op-card .stats { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.op-card .stats strong { color: var(--text); font-size: 16px; display: block; }

/* Revendedor card */
.rev-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; gap: 12px; align-items: center;
}
.rev-card .info { flex: 1; }
.rev-card .info .name { font-weight: 700; }
.rev-card .info .email { color: var(--muted); font-size: 12px; }
.rev-card .actions { display: flex; gap: 6px; }

/* Activity feed */
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; }
.feed-item {
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px;
}
.feed-item .ico { color: var(--primary); margin-top: 2px; }
.feed-item .title { font-weight: 600; }
.feed-item .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.feed-item .ts { color: var(--muted-2); font-size: 11px; margin-left: auto; white-space: nowrap; }

/* Login error */
.login-error {
  background: var(--danger-soft); color: var(--danger);
  padding: 8px 12px; border-radius: var(--radius);
  margin-top: 12px; font-size: 13px; display: none;
}
.login-error.show { display: block; }

/* Toggle switch */
.ui-toggle {
  position: relative; width: 48px; height: 26px;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 999px; transition: background .15s;
  cursor: pointer; flex-shrink: 0;
}
.ui-toggle .knob {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: var(--muted); border-radius: 50%;
  transition: all .15s;
}
.ui-toggle.on { background: var(--success); border-color: var(--success); }
.ui-toggle.on .knob { background: #fff; left: 24px; }
.ui-toggle[data-size="lg"] { width: 64px; height: 34px; }
.ui-toggle[data-size="lg"] .knob { width: 28px; height: 28px; }
.ui-toggle[data-size="lg"].on .knob { left: 34px; }

/* Status indicator dots */
.dot-pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); position: relative;
}
.dot-pulse::after {
  content: ''; position: absolute; inset: -4px;
  border-radius: 50%; background: var(--success);
  opacity: 0.3; animation: pulse 1.8s ease-out infinite;
}
.dot-pulse.off { background: var(--danger); }
.dot-pulse.off::after { background: var(--danger); }
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(2); opacity: 0; }
}

/* Secret input with reveal toggle */
.secret-input { position: relative; }
.secret-input input { padding-right: 40px; }
.secret-input .reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; padding: 6px; color: var(--muted);
  border-radius: 4px; cursor: pointer;
}
.secret-input .reveal:hover { color: var(--text); background: var(--bg-2); }

/* Config sections */
.config-section { margin-bottom: 16px; }
.config-section h3 { display:flex; align-items:center; gap:8px; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* Responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app.collapsed { grid-template-columns: 1fr; }
  .topbar {
    z-index: 210;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    gap: 8px;
  }
  .topbar .page-title {
    font-size: 15px;
    margin-right: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
  }
  .sidebar {
    position: fixed; z-index: 200; top: 0; left: 0;
    width: min(var(--sidebar-w), 86vw);
    height: 100vh; height: 100dvh;
    transform: translateX(-100%); transition: transform .2s;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 199;
  }
  .sidebar-overlay.show { display: block; }
  .content {
    padding: 14px 12px calc(16px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }
  .content h2.page-h { flex-wrap: wrap; font-size: 18px; margin-bottom: 12px; }
  .search-trigger { display: none; }

  .card { padding: 14px; min-width: 0; max-width: 100%; overflow: hidden; }
  .card .card-head { flex-wrap: wrap; }
  .card .card-head .actions, .card .card-head .row { width: 100%; }
  .card .card-head select, .card .card-head input { width: 100%; max-width: none !important; }

  .table-toolbar { align-items: stretch; }
  .table-toolbar input.search,
  .table-toolbar select,
  .table-toolbar input[type="date"] {
    max-width: none !important;
    width: 100%;
    flex: 1 1 100%;
  }
  .table-wrap table { min-width: 640px; }
  td .row-actions { opacity: 1; flex-wrap: wrap; }

  .grid.cards-2 { grid-template-columns: 1fr; }
  .kpi .value { font-size: 22px; }
  .rev-card { flex-wrap: wrap; }
  .rev-card .actions { width: 100%; justify-content: flex-end; }
  .feed-item { flex-wrap: wrap; }
  .feed-item .ts { margin-left: 0; width: 100%; }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal, .modal.lg, .modal.xl {
    max-width: 100%;
    max-height: min(94dvh, 100%);
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal .foot { flex-wrap: wrap; }
  .modal .foot button { flex: 1 1 auto; min-height: 44px; }

  .dropdown-menu {
    min-width: 0 !important;
    width: min(340px, calc(100vw - 24px));
    right: 0;
    max-height: 70vh;
  }

  .toast-container {
    left: 12px; right: 12px; top: auto; bottom: 16px;
    align-items: stretch;
  }
  .toast { min-width: 0; max-width: none; width: 100%; }

  .login-split .form-side {
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    align-items: flex-start;
    padding-top: max(48px, env(safe-area-inset-top));
  }
  .cmdk { padding-top: 8vh; }

  #chart-receita, #chart-operadoras, #chart-vendas { max-height: 220px; }

  .op-card table { display: block; overflow-x: auto; }

  input, select, textarea { font-size: 16px; }
  .topbar .burger, .iconbtn { width: 44px; height: 44px; min-width: 44px; }
}

@media (max-width: 480px) {
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  .kpi { padding: 14px; }
  .empty-state { padding: 36px 12px; }
  .pagination { flex-wrap: wrap; }
}

@media (hover: none) {
  button:hover, .btn:hover, .kpi:hover, .op-card:hover { transform: none; }
}

@media (min-width: 901px) {
  .sidebar-overlay { display: none !important; }
}