/* FASTFY-API — Plataforma WhatsApp · design system do painel */
:root {
  --green-900: #052e1c;
  --green-800: #0a3d26;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-50: #effaf3;
  --neon: #39ff88;
  --ink: #0f1a15;
  --ink-2: #334139;
  --muted: #64736b;
  --line: #e4e9e6;
  --line-2: #eef2f0;
  --bg: #f5f7f6;
  --card: #ffffff;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --violet-600: #7c3aed;
  --violet-100: #ede9fe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 26, 21, 0.04), 0 4px 16px rgba(15, 26, 21, 0.05);
  --shadow-lg: 0 20px 60px rgba(5, 46, 28, 0.18);
  --sidebar: 264px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--green-500); outline-offset: 2px; border-radius: 6px; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; font-style: italic; line-height: 1; }
.brand-name span { color: var(--green-500); }
.brand-sub { font-size: 10px; letter-spacing: 0.32em; opacity: 0.8; margin-top: 4px; font-weight: 600; }

/* ---------- Layout do painel ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 24px 16px;
  background: radial-gradient(120% 60% at 0% 100%, rgba(34, 197, 94, 0.18), transparent 60%), linear-gradient(180deg, #0b1712 0%, #0c1f17 100%);
  color: #e6efe9; overflow-y: auto; z-index: 30;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: #d3ded8; font-weight: 500; font-size: 15px;
  border: 1px solid transparent; transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav a[aria-current='page'] { background: linear-gradient(90deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.55)); color: #fff; border-color: rgba(57, 255, 136, 0.35); box-shadow: 0 6px 20px rgba(22, 163, 74, 0.28); }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav .soon { white-space: nowrap; margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); color: #a9bab1; font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); color: #e6efe9; }
.side-card:hover { text-decoration: none; background: rgba(255, 255, 255, 0.08); }
.side-card small { display: block; color: #9fb2a8; font-size: 12px; }
.side-card svg { width: 20px; height: 20px; flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.dark { background: #1f2a25; color: #fff; }
.user-menu-btn { margin-left: auto; background: none; border: 0; color: #cfdad4; padding: 6px; border-radius: 8px; cursor: pointer; }
.user-menu-btn:hover { background: rgba(255, 255, 255, 0.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 24px 32px 8px; }
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; line-height: 1.15; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; }
.content { padding: 16px 32px 40px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 17px; letter-spacing: -0.01em; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 20px; }
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .ico svg { width: 24px; height: 24px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; letter-spacing: -0.02em; }
.stat span { font-weight: 600; font-size: 14px; }
.stat small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.tone-green .ico { background: var(--green-100); color: var(--green-700); }
.tone-red .ico { background: var(--red-100); color: var(--red-600); }
.tone-blue .ico { background: var(--blue-100); color: var(--blue-600); }
.tone-violet .ico { background: var(--violet-100); color: var(--violet-600); }
.tone-amber .ico { background: var(--amber-100); color: var(--amber-600); }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; font-size: 14.5px; cursor: pointer; transition: transform 0.05s, background 0.15s, box-shadow 0.15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #f7f9f8; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--green-600); border-color: var(--green-600); color: #fff; box-shadow: 0 6px 18px rgba(22, 163, 74, 0.25); }
.btn-primary:hover { background: var(--green-700); }
.btn-danger { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-outline { color: var(--red-600); border-color: #fca5a5; background: #fff; }
.btn-danger-outline:hover { background: var(--red-100); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); }
.btn-lg { padding: 14px 20px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 12.5px; }
.field .err { color: var(--red-600); font-size: 13px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; transition: border 0.15s, box-shadow 0.15s;
}
.input-wrap > svg + .input { padding-left: 42px; }
.input:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.input[aria-invalid='true'] { border-color: var(--red-600); }
.input-wrap .trail { position: absolute; right: 6px; display: flex; gap: 2px; }
.input-wrap .trail button { background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.input-wrap .trail button:hover { background: var(--line-2); color: var(--ink); }
.input-wrap .trail svg { width: 18px; height: 18px; }
.input.with-trail { padding-right: 84px; }
.mono { font-family: var(--mono); font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--green-600); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cfd8d3; transition: background 0.15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch input:checked + span { background: var(--green-600); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--green-500); outline-offset: 2px; }

/* ---------- Status e etiquetas ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--green-100); color: var(--green-700); }
.badge.off { background: var(--red-100); color: var(--red-600); }
.badge.wait { background: var(--amber-100); color: var(--amber-600); }
.badge.plain::before { display: none; }
.tag { display: inline-flex; padding: 3px 10px; border-radius: 8px; font-size: 13px; font-weight: 500; background: var(--blue-100); color: #1d4ed8; }
.tag:nth-child(3n + 2) { background: var(--green-100); color: var(--green-700); }
.tag:nth-child(3n + 3) { background: var(--violet-100); color: var(--violet-600); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Abas e segmentos ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 16px; color: var(--ink-2); font-weight: 500; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected='true'] { color: var(--green-700); border-bottom-color: var(--green-600); font-weight: 600; }
.segment { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.segment button { border: 1px solid transparent; background: var(--line-2); padding: 8px 14px; border-radius: 10px; font-weight: 500; cursor: pointer; }
.segment button[aria-pressed='true'] { background: var(--green-600); color: #fff; }

/* ---------- Tabelas / listas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 10px 12px; background: #f8faf9; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

.inst-list { display: flex; flex-direction: column; gap: 14px; }
.inst {
  display: grid; grid-template-columns: auto minmax(180px, 1.3fr) minmax(200px, 1.4fr) auto; gap: 20px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.wa-ico { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(145deg, #25d366, #128c4e); color: #fff; flex: none; }
.wa-ico.off { background: linear-gradient(145deg, #f87171, #ef4444); }
.wa-ico svg { width: 32px; height: 32px; }
.wa-ico.sm { width: 36px; height: 36px; border-radius: 10px; }
.wa-ico.sm svg { width: 20px; height: 20px; }
.inst h3 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.inst .num { color: var(--ink-2); display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; }
.inst .meta { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.inst .meta small { display: block; color: var(--muted); font-size: 12.5px; }
.inst .meta .mi { display: flex; gap: 8px; align-items: flex-start; }
.inst .meta .mi svg { width: 18px; height: 18px; color: var(--muted); margin-top: 2px; }
.inst .actions { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 26, 21, 0.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade 0.15s ease-out; }
.modal { background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); width: min(1060px, 100%); max-height: calc(100vh - 40px); overflow: auto; position: relative; animation: pop 0.18s ease-out; }
.modal.sm { width: min(520px, 100%); }
.modal-head { padding: 28px 32px 8px; }
.modal-head h2 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }
.modal-close { position: absolute; top: 18px; right: 18px; background: none; border: 0; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--muted); }
.modal-close:hover { background: var(--line-2); color: var(--ink); }
.modal-body { padding: 20px 32px 28px; }
.modal-foot { display: flex; gap: 12px; padding: 0 32px 28px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } }

/* Wizard */
.wizard { display: grid; grid-template-columns: 230px 1fr 300px; gap: 24px; }
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 40px 1fr; gap: 12px; position: relative; padding-bottom: 28px; }
.step:not(:last-child)::before { content: ''; position: absolute; left: 19px; top: 42px; bottom: 2px; width: 2px; background: var(--line); }
.step.done:not(:last-child)::before { background: var(--green-500); }
.step .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e4e9e6; color: var(--muted); }
.step.current .dot, .step.done .dot { background: var(--green-600); color: #fff; }
.step.done .dot svg { width: 20px; height: 20px; }
.step b { display: block; font-size: 15px; }
.step small { display: block; color: var(--muted); font-size: 13.5px; }
.step button.link { background: none; border: 0; padding: 0; color: var(--green-700); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.aside { background: var(--green-50); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.aside h3 { margin: 0; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.aside .tip { display: grid; grid-template-columns: 36px 1fr; gap: 12px; background: #fff; border-radius: 12px; padding: 12px; }
.aside .tip .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--green-100); color: var(--green-700); display: grid; place-items: center; }
.aside .tip .ico svg { width: 20px; height: 20px; }
.aside .tip b { display: block; font-size: 14px; }
.aside .tip small { color: var(--muted); font-size: 13px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.method { position: relative; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 20px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.method[aria-checked='true'] { border-color: var(--green-600); background: var(--green-50); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.method .radio { position: absolute; top: 16px; right: 16px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b8c4be; }
.method[aria-checked='true'] .radio { border-color: var(--green-600); box-shadow: inset 0 0 0 4px #fff; background: var(--green-600); }
.method .big { width: 56px; height: 56px; border-radius: 14px; background: var(--green-100); color: var(--green-700); display: grid; place-items: center; }
.method .big svg { width: 30px; height: 30px; }
.method ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.method li { display: flex; gap: 8px; align-items: center; }
.method li svg { width: 16px; height: 16px; color: var(--green-600); flex: none; }
.qr-panel { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: center; }
.qr-box { width: 250px; height: 250px; border: 1px solid var(--line); border-radius: 14px; display: grid; place-items: center; background: #fff; overflow: hidden; position: relative; }
.qr-box img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-box .qr-over { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.92); display: grid; place-items: center; text-align: center; padding: 16px; }
.code-box { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: 0.12em; background: var(--green-50); border: 1px dashed var(--green-500); border-radius: 14px; padding: 18px; text-align: center; }
.numbered { list-style: none; counter-reset: n; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.numbered li { counter-increment: n; position: relative; padding-left: 38px; min-height: 26px; line-height: 1.45; padding-top: 2px; }
.numbered li::before { content: counter(n); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--green-100); color: var(--green-700); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.timer { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--green-600); transition: width 1s linear; }
.progress-steps { display: grid; grid-template-columns: repeat(4, 1fr); position: relative; margin: 8px 0; }
.progress-steps::before { content: ''; position: absolute; top: 11px; left: 12.5%; right: 12.5%; height: 2px; background: var(--line); }
.progress-steps div { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); position: relative; text-align: center; }
.progress-steps div i { width: 24px; height: 24px; border-radius: 50%; background: #d7dfdb; display: grid; place-items: center; border: 4px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.progress-steps div.done i, .progress-steps div.now i { background: var(--green-600); }
.progress-steps div.done, .progress-steps div.now { color: var(--ink); font-weight: 600; }
.progress-steps div.done i svg { width: 12px; height: 12px; color: #fff; }
.ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green-500) var(--p, 25%), #e6efe9 0); position: relative; margin: 0 auto; }
.ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.ring .wa-ico { position: relative; width: 84px; height: 84px; border-radius: 50%; }
.ring.busy { animation: spin 2.4s linear infinite; }
.ring.busy .wa-ico { animation: spin 2.4s linear infinite reverse; }
.success-mark { width: 150px; height: 150px; border-radius: 50%; background: var(--green-600); color: #fff; display: grid; place-items: center; margin: 0 auto; box-shadow: 0 16px 40px rgba(22, 163, 74, 0.35); animation: pop 0.3s ease-out; }
.success-mark svg { width: 76px; height: 76px; }
.confetti { position: relative; }
.confetti i { position: absolute; width: 10px; height: 6px; border-radius: 2px; transform: rotate(var(--r)); animation: pop 0.6s ease-out both; }
.suggest { display: flex; flex-direction: column; }
.suggest a { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.suggest a:hover { text-decoration: none; background: rgba(255, 255, 255, 0.6); }
.suggest a .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--green-100); color: var(--green-700); display: grid; place-items: center; }
.suggest a .ico svg { width: 20px; height: 20px; }
.suggest b { display: block; font-size: 14.5px; }
.suggest small { color: var(--muted); font-size: 13px; }

/* ---------- Avisos ---------- */
.note { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 16px; border-radius: 12px; font-size: 14px; }
.note svg { width: 24px; height: 24px; }
.note b { display: block; margin-bottom: 2px; }
.note.info { background: #eef4ff; color: #1e3a8a; }
.note.info svg { color: var(--blue-600); }
.note.warn { background: #fff7e6; color: #7a4a00; border: 1px solid #fde2a7; }
.note.warn svg { color: var(--amber-600); }
.note.ok { background: var(--green-50); color: var(--green-800); }
.note.ok svg { color: var(--green-600); }
.note.err { background: #fff1f1; color: #7f1d1d; }
.note.err svg { color: var(--red-600); }

/* Estados */
.state { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.state .ico { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--green-100); color: var(--green-700); }
.state .ico svg { width: 32px; height: 32px; }
.state.error .ico { background: var(--red-100); color: var(--red-600); }
.state h3 { margin: 6px 0 0; font-size: 18px; }
.state p { margin: 0; color: var(--muted); max-width: 440px; }
.skeleton { background: linear-gradient(90deg, #eef2f0 25%, #f6f8f7 37%, #eef2f0 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop 0.2s ease-out; max-width: 380px; }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--green-500); }
.toast.err { background: #7f1d1d; }

/* Tooltip simples */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; font-weight: 500;
  padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 50;
}

/* Menu de opções */
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 60; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--line-2); }
.menu button.danger { color: var(--red-600); }
.menu svg { width: 18px; height: 18px; }
.relative { position: relative; }

/* Gráficos */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.kv { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px 16px; align-items: center; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.activity li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.activity li small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.activity .ico { width: 36px; height: 36px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; color: var(--ink-2); }
.activity .ico.g { background: var(--green-100); color: var(--green-700); }
.activity .ico.r { background: var(--red-100); color: var(--red-600); }
.activity .ico svg { width: 18px; height: 18px; }
.activity b { font-size: 14px; font-weight: 600; display: block; }
.activity small { color: var(--muted); font-size: 12.5px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick button { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.quick button:hover { border-color: var(--green-500); background: var(--green-50); }
.quick svg { width: 26px; height: 26px; color: var(--green-600); }
.bubble { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.bubble.out { background: #dcf8c6; align-self: flex-end; }
.bubble small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.chat { display: flex; flex-direction: column; gap: 8px; background: #efeae2; border-radius: 12px; padding: 16px; max-height: 480px; overflow: auto; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: radial-gradient(80% 60% at 20% 110%, rgba(34, 197, 94, 0.35), transparent 60%), radial-gradient(60% 50% at 70% 20%, rgba(34, 197, 94, 0.18), transparent 60%), #06110c; color: #fff; }
.auth-hero { padding: 64px 56px; display: flex; flex-direction: column; gap: 28px; justify-content: center; max-width: 720px; }
.auth-hero .brand img { width: 72px; height: 72px; }
.auth-hero .brand-name { font-size: 48px; }
.auth-hero .brand-sub { font-size: 14px; letter-spacing: 0.4em; }
.auth-hero hr { width: 84px; border: 0; height: 3px; background: var(--green-500); border-radius: 99px; margin: 0; }
.auth-hero h1 { font-size: clamp(32px, 4vw, 50px); line-height: 1.08; margin: 0; letter-spacing: -0.03em; }
.auth-hero h1 span { color: var(--green-500); }
.auth-hero p.lead { font-size: 19px; color: #c9d6cf; margin: 0; max-width: 520px; }
.benefits { display: flex; flex-direction: column; gap: 16px; }
.benefit { display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: center; }
.benefit .ico { width: 56px; height: 56px; border-radius: 14px; background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(57, 255, 136, 0.2); display: grid; place-items: center; color: var(--green-500); }
.benefit .ico svg { width: 26px; height: 26px; }
.benefit b { display: block; font-size: 17px; }
.benefit small { color: #b9c9c0; font-size: 14.5px; }
.auth-foot { display: flex; gap: 28px; flex-wrap: wrap; color: #c9d6cf; font-size: 14px; }
.auth-foot div { display: flex; gap: 10px; align-items: center; }
.auth-foot svg { width: 26px; height: 26px; color: var(--green-500); }
.auth-foot b { display: block; color: #fff; font-size: 16px; }
.auth-side { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(520px, 100%); background: #fff; color: var(--ink); border-radius: 24px; padding: 40px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; gap: 18px; }
.auth-card h2 { font-size: 40px; margin: 0; letter-spacing: -0.03em; line-height: 1.1; }
.auth-card .sub { color: var(--muted); margin: -8px 0 6px; font-size: 16px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.auth-card .foot { text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .wizard { grid-template-columns: 200px 1fr; }
  .wizard .aside { grid-column: 1 / -1; }
  .inst { grid-template-columns: auto 1fr auto; }
  .inst .meta { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px 28px 8px; gap: 20px; }
  .auth-hero .benefits, .auth-hero .auth-foot { display: none; }
  .auth-hero .brand-name { font-size: 34px; }
  .auth-hero .brand img { width: 52px; height: 52px; }
  .auth-side { padding: 20px 16px 40px; }
  .auth-card { padding: 28px 22px; }
  .auth-card h2 { font-size: 32px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform 0.2s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 20; }
  .menu-toggle { display: grid; place-items: center; }
  .topbar { padding: 16px 16px 4px; flex-wrap: wrap; }
  .topbar h1 { font-size: 24px; }
  .content { padding: 12px 16px 32px; }
  .wizard { grid-template-columns: 1fr; }
  .wizard .steps { flex-direction: row; overflow-x: auto; gap: 8px; }
  .wizard .step { grid-template-columns: 32px auto; padding-bottom: 0; min-width: max-content; }
  .wizard .step::before { display: none; }
  .wizard .step .dot { width: 32px; height: 32px; }
  .wizard .step small, .wizard .step button.link { display: none; }
  .modal-head { padding: 22px 20px 4px; }
  .modal-head h2 { font-size: 22px; }
  .modal-body { padding: 16px 20px 20px; }
  .modal-foot { padding: 0 20px 20px; flex-wrap: wrap; }
  .method-grid { grid-template-columns: 1fr; }
  .qr-panel { grid-template-columns: 1fr; justify-items: center; }
  .kv { grid-template-columns: 1fr auto; }
  .kv dt { grid-column: 1 / -1; margin-bottom: -8px; }
}
@media (max-width: 640px) {
  .inst { grid-template-columns: auto 1fr; gap: 14px; padding: 16px; }
  .inst .actions { grid-column: 1 / -1; }
  .inst .actions .btn:first-child { flex: 1; }
  .wa-ico { width: 48px; height: 48px; }
  .overlay { padding: 0; align-items: end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 94vh; }
  .quick { grid-template-columns: 1fr 1fr; }
  .bubble { max-width: 90%; }
}

/* ---------- Adições: dashboard, instâncias, detalhes ---------- */
h2 > svg, h3 > svg { width: 20px; height: 20px; flex: none; color: var(--green-600); }
.card h2, .card h3 { display: flex; align-items: center; gap: 8px; }
.sidebar .brand-name { font-size: 20px; }
.sidebar .brand-sub { font-size: 9px; letter-spacing: 0.2em; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.table td { white-space: nowrap; }
.table td.clip { white-space: nowrap; }
.kv { grid-template-columns: 112px minmax(0, 1fr) auto; font-size: 14px; }
.kv dd { overflow-wrap: anywhere; }
.kv .icon-btn { justify-self: end; }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-sm svg { width: 16px; height: 16px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.small { font-size: 13px; }
.block { display: block; }
.center { text-align: center; justify-items: center; }
.center-row { justify-content: center; }
.ic-sm { width: 16px; height: 16px; color: var(--muted); }
.ic-lg { width: 40px; height: 40px; color: var(--muted); }
.chip { font-size: 12.5px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); background: #fff; white-space: nowrap; }
.card-head.wrap { flex-wrap: wrap; }
.card.flat { box-shadow: none; }
a.plain { color: inherit; }
.icon-btn { background: none; border: 0; padding: 4px; border-radius: 6px; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.period-wrap { min-width: 190px; }
.period-wrap select { padding-left: 42px; cursor: pointer; }

.dash-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.8fr) minmax(290px, 1fr); gap: 20px; }
.dash-row2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; }
.promo { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 16px; }
.promo .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--green-100); color: var(--green-700); }
.promo .ico.blue { background: var(--blue-100); color: var(--blue-600); }
.promo .ico svg { width: 22px; height: 22px; }
.promo b { display: block; }
.promo p { margin: 2px 0 10px; color: var(--muted); font-size: 13.5px; }

.chart-area { position: relative; width: 100%; }
.chart-area svg { display: block; max-width: 100%; }
.chart-tip { position: absolute; top: 0; background: var(--ink); color: #fff; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; pointer-events: none; box-shadow: var(--shadow-lg); z-index: 5; white-space: nowrap; }
.chart-tip b { display: block; margin-bottom: 4px; }
.chart-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.bar-group { cursor: default; outline: none; }
.bar-group.on .hit { fill: rgba(15, 26, 21, 0.04); }
.donut { position: relative; width: 150px; height: 150px; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font-size: 30px; line-height: 1; }
.donut-center small { color: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.donut-legend li { display: grid; grid-template-columns: minmax(0, 1fr) auto 38px; gap: 6px; align-items: center; font-size: 14px; }
.donut-legend .badge { font-size: 12px; padding: 3px 8px; }
.donut-legend small { color: var(--muted); text-align: right; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px; }
.toolbar select.input { width: auto; min-width: 170px; }
.segment.icons button { padding: 8px 10px; display: grid; place-items: center; }
.segment.icons svg { width: 18px; height: 18px; }
.inst-list.as-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.inst.inst-grid { grid-template-columns: auto 1fr; }
.inst.inst-grid .meta { grid-column: 1 / -1; }
.inst.inst-grid .actions { grid-column: 1 / -1; }
.inst.inst-grid .actions .btn:first-child { flex: 1; }
.inst .meta b { display: block; font-size: 15px; }

/* Wizard */
.wizard-modal { width: min(1120px, 100%); }
.wz-main { min-width: 0; }
.steps { list-style: none; margin: 0; padding: 0; }
.aside-hero { background: #fff; border-radius: 14px; padding: 18px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.aside-hero small { color: var(--muted); font-size: 13px; }
.wa-ico.big { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 6px; }
.wa-ico.big svg { width: 40px; height: 40px; }
.tag-input { display: flex; flex-direction: column; gap: 10px; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag.ghost { border: 1px dashed #b9c6bf; background: #fff !important; color: var(--ink-2) !important; cursor: pointer; font: inherit; font-size: 13px; }
.tag.ghost:hover { border-color: var(--green-500); color: var(--green-700) !important; }
.tag.ghost.add { display: inline-flex; align-items: center; gap: 4px; }
.tag.ghost.add svg { width: 14px; height: 14px; }
.tag-new { width: 160px; padding: 6px 10px; font-size: 13px; }
.tag.removable { display: inline-flex; align-items: center; gap: 4px; }
.tag.removable button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; display: grid; opacity: 0.7; }
.tag.removable button:hover { opacity: 1; }
.tag.removable svg { width: 13px; height: 13px; }
.qr-logo { position: absolute; width: 48px; height: 48px; border-radius: 12px; background: #fff; display: grid; place-items: center; color: #16a34a; box-shadow: 0 0 0 4px #fff; }
.qr-logo svg { width: 36px; height: 36px; }
.qr-over b { display: block; font-size: 17px; margin-top: 6px; }
.qr-over p { margin: 6px 0 0; font-size: 14px; }
.big-spin { width: 34px; height: 34px; border-width: 3px; color: var(--green-600); display: inline-block; }
.timer b { display: block; font-size: 14.5px; }
.timer small { color: var(--muted); font-size: 13px; }
.timer svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.big-title { font-size: 26px !important; margin: 6px 0 0 !important; letter-spacing: -0.02em; }
.phone-big { font-size: 20px; font-weight: 700; margin: 0; }
.success-stage { position: relative; width: 260px; height: 220px; display: grid; place-items: center; }
.confetti { position: absolute; inset: 0; }
.numbered li small.block { display: block; }
.modal-foot .grow .btn { width: 100%; }

/* Detalhes da instância */
.inst-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.inst-head h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 8px; }
.inst-head .num { color: var(--ink-2); font-size: 16px; margin-top: 2px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.kv.two { grid-template-columns: 136px minmax(0, 1fr); }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.mini { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.mini .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.mini .ico svg { width: 20px; height: 20px; }
.mini b { display: block; font-size: 20px; line-height: 1.1; }
.mini small { color: var(--muted); font-size: 12.5px; }
.events { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.check.ev { align-items: flex-start; }
.check.ev input { margin-top: 3px; flex: none; }
.check.ev b { display: block; font-size: 14px; font-weight: 600; }
.check.ev small { color: var(--muted); font-size: 12.5px; }
.disabled { opacity: 0.55; }
.dots { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.dir { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.dir svg { width: 16px; height: 16px; }
.dir.in { background: var(--blue-100); color: var(--blue-600); }
.dir.out { background: var(--green-100); color: var(--green-700); }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
td.clip { display: table-cell; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.danger-zone { border-color: #fecaca; }
pre.code { background: #0f1a15; color: #d1fae5; padding: 14px; border-radius: 12px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; margin: 0; white-space: pre; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--line-2); padding: 1px 5px; border-radius: 5px; }

@media (max-width: 1280px) {
  .dash-row { grid-template-columns: 1fr 1fr; }
  .dash-row > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .detail-grid, .split { grid-template-columns: 1fr; }
  .dash-row2 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .two-col, .events { grid-template-columns: 1fr; }
  .dash-row { grid-template-columns: 1fr; }
  .toolbar .input-wrap.grow { flex-basis: 100%; order: -1; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .period-wrap { min-width: 0; }
  .success-stage { width: 220px; height: 190px; }
}
@media (max-width: 640px) {
  .three-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { flex-direction: column; gap: 10px; }
  .stat b { font-size: 22px; }
  .kv.two { grid-template-columns: 1fr; }
  .kv.two dt { margin-bottom: -8px; }
  .toolbar select.input { flex: 1; min-width: 0; }
  .topbar .row.wrap { width: 100%; }
  .topbar .row.wrap > * { flex: 1; }
  .clip { max-width: 180px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Celular: botão do menu e ações do topo */
.menu-toggle svg { width: 22px; height: 22px; }
@media (max-width: 640px) {
  .topbar .row.wrap > .period-wrap { flex: 1 1 100%; }
}

/* Equipe */
.avatar.sm { width: 36px; height: 36px; font-size: 13px; background: var(--green-100); color: var(--green-700); }
.person { gap: 12px; }
.badge.role-owner { background: #ede9fe; color: #5b21b6; }
.badge.role-member { background: #eef2f0; color: var(--ink-2); }
.role-grid .method { padding: 16px; }
.two-col.tight { gap: 14px; }
@media (max-width: 640px) { .role-grid { grid-template-columns: 1fr; } }
