/* ─── Reset & Fonte ────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Brand */
  --green:      #25d366;
  --green-dark: #1aab52;
  --green-dim:  rgba(37,211,102,0.09);
  --green-glow: rgba(37,211,102,0.2);

  /* Semantic */
  --red:    #ff4757;
  --orange: #ff6b35;
  --blue:   #4f8ef7;
  --purple: #a855f7;

  /* Surface */
  --bg:     #0b0d12;
  --bg2:    #111318;
  --bg3:    #181c24;
  --bg4:    #21262f;
  --bg5:    #2a303c;

  /* Text */
  --text:   #eef0f5;
  --muted:  #5c6478;
  --muted2: #8892a4;

  /* Border */
  --border:  #1f2330;
  --border2: #2a3040;

  /* Effects */
  --radius:    10px;
  --radius-lg: 14px;
  --shadow:    0 1px 3px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.5), 0 12px 48px rgba(0,0,0,0.35);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

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

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 3px;
  flex-shrink: 0;
}

.logo {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 6px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.logo-img {
  width: 160px; height: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(37,211,102,.55));
}

.logo-text {
  font-size: 17px; font-weight: 800;
  background: linear-gradient(90deg, var(--green), #80ffb0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.4px;
}

.user-info {
  font-size: 12px; font-weight: 600; color: var(--text);
  padding: 4px 8px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.admin-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #fbbf24;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 4px; padding: 2px 8px;
  display: inline-block; margin: 0 6px 8px;
}

/* Credits bar */
.credits-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  margin: 2px 0 6px;
}

.credits-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 7px;
}

.credits-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted2);
}

.credits-count { font-size: 11px; font-weight: 700; color: var(--green); }
.credits-count.low      { color: var(--orange); }
.credits-count.critical { color: var(--red); }

.credits-track {
  height: 3px; background: var(--border2); border-radius: 2px; overflow: hidden;
}

.credits-fill {
  height: 100%; background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: 2px; transition: width .6s ease;
}
.credits-fill.low      { background: linear-gradient(90deg, #c2410c, var(--orange)); }
.credits-fill.critical { background: linear-gradient(90deg, #991b1b, var(--red)); }

.credits-expires { font-size: 10px; color: var(--muted); margin-top: 5px; }

/* Nav */
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; margin-top: 2px; }

.nav-btn {
  background: transparent; border: none;
  color: var(--muted2); font-size: 13px; font-weight: 500;
  padding: 8px 10px; border-radius: 7px;
  cursor: pointer; text-align: left;
  transition: all .15s ease;
  font-family: inherit; letter-spacing: -0.1px;
}

.nav-btn:hover  { background: var(--bg3); color: var(--text); }
.nav-btn.active {
  background: var(--green-dim);
  color: var(--green); font-weight: 600;
  border: 1px solid rgba(37,211,102,0.18);
  box-shadow: inset 0 0 0 1px rgba(37,211,102,0.06);
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto; display: flex; flex-direction: column;
  gap: 6px; padding-top: 12px; border-top: 1px solid var(--border);
}

.status-badge {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted2); padding: 2px 6px;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border2); flex-shrink: 0; transition: all .3s;
}
.dot.conectado    { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.dot.conectando   { background: var(--orange); animation: blink 1s infinite; }
.dot.reconectando { background: var(--orange); animation: blink .5s infinite; }
.dot.desconectado { background: var(--border2); }
.dot.erro         { background: var(--red); }

@keyframes blink { 0%,100% { opacity:1 } 50% { opacity:.2 } }

.btn-sair {
  width: 100%; padding: 7px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted2); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: inherit; text-align: center;
}
.btn-sair:hover { border-color: var(--red); color: var(--red); background: rgba(255,71,87,.05); }

.admin-link { color: #fbbf24 !important; border-color: rgba(251,191,36,.25) !important; }
.admin-link:hover { background: rgba(251,191,36,.05) !important; }

/* ─── Main Content ───────────────────────────────────────────────────────────── */
.main {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
}

.tab-content { display: none; flex-direction: column; gap: 12px; }
.tab-content.active { display: flex; }

.page-header { display: flex; flex-direction: column; gap: 4px; }
.page-header h1 {
  font-size: 21px; font-weight: 700;
  letter-spacing: -0.5px; color: var(--text);
}
.page-header p { color: var(--muted2); font-size: 13px; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%);
}
.card-header h2 { font-size: 13px; font-weight: 600; color: var(--text); }
.card-body { padding: 14px 16px; }

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  opacity: 0; transition: opacity .2s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.stat-card:hover::before { opacity: 1; }

.stat-info { display: flex; flex-direction: column; gap: 6px; }
.stat-value {
  font-size: 32px; font-weight: 800;
  color: var(--text); letter-spacing: -1.5px; line-height: 1;
}
.stat-label { font-size: 11.5px; color: var(--muted2); font-weight: 500; }

/* ─── Botões ─────────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 20px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s ease; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }

.btn-success {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10;
  box-shadow: 0 2px 8px var(--green-glow);
}
.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--green), #40ff8a);
  box-shadow: 0 4px 16px var(--green-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b, var(--red));
  color: white;
  box-shadow: 0 2px 8px rgba(255,71,87,.25);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--red), #ff6b7a);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 5px 13px; font-size: 12px;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px;
}
.btn-sm:hover { border-color: var(--muted); background: var(--bg4); }

/* ─── Formulários ────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-group label {
  font-size: 11px; font-weight: 700;
  color: var(--muted2); text-transform: uppercase; letter-spacing: 0.6px;
}

.form-hint {
  font-weight: 400; font-size: 11px;
  color: var(--green-dark); margin-left: 6px;
  text-transform: none; letter-spacing: 0;
}

.form-input, .form-textarea, select.form-input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus, .form-textarea:focus, select.form-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}
.form-input::placeholder { color: var(--muted); }

.form-textarea {
  resize: vertical; line-height: 1.6;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12.5px;
}

/* ─── Conexão ────────────────────────────────────────────────────────────────── */
.connection-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 32px;
  padding: 24px 20px;
}

.qr-column {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}

.qr-area {
  width: 260px; height: 260px;
  background: var(--bg3);
  border-radius: 14px;
  border: 2px dashed var(--border2);
  display: flex; align-items: center; justify-content: center;
  transition: all .3s ease;
  position: relative; overflow: hidden;
}

.qr-area.scanning {
  border-style: solid;
  border-color: var(--orange);
  animation: qrPulse 1.8s ease-in-out infinite;
}

.qr-area.active {
  border-style: solid;
  border-color: var(--green);
  background: #060f09;
  box-shadow: 0 0 30px rgba(37,211,102,.1), inset 0 0 20px rgba(37,211,102,.03);
}

@keyframes qrPulse {
  0%,100% { border-color: var(--orange); box-shadow: 0 0 0 rgba(255,107,53,0); }
  50%      { border-color: #ffb347;      box-shadow: 0 0 20px rgba(255,107,53,.15); }
}

.qr-placeholder { text-align: center; padding: 24px; color: var(--muted2); }
.qr-placeholder .qr-icon {
  font-size: 52px; line-height: 1;
  color: var(--border2); margin-bottom: 14px;
}
.qr-placeholder p { font-size: 12.5px; line-height: 1.7; }
.qr-placeholder strong { color: var(--text); }

#qrImage { width: 240px; height: 240px; border-radius: 8px; }

.connected-info { text-align: center; padding: 20px; }
.check-text {
  font-size: 11px; font-weight: 800; color: var(--green);
  letter-spacing: 2px; margin-bottom: 10px;
  text-transform: uppercase;
}
.connected-name { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.number-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10; font-weight: 700;
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-family: 'SF Mono', monospace;
}

.conn-btns { display: flex; gap: 8px; }
.status-msg { font-size: 12px; color: var(--muted2); text-align: center; line-height: 1.6; }

.info-column { display: flex; flex-direction: column; gap: 20px; padding-top: 6px; }

.steps-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted); margin-bottom: 4px;
}

.steps-list { display: flex; flex-direction: column; gap: 12px; }

.step { display: flex; align-items: flex-start; gap: 12px; }

.step-num {
  width: 22px; height: 22px; flex-shrink: 0;
  background: var(--bg4); border: 1px solid var(--border2);
  border-radius: 50%; font-size: 10px; font-weight: 700;
  color: var(--muted2);
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; transition: all .2s;
}

.step-num.done {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  border-color: transparent; color: #0a1a10;
  box-shadow: 0 2px 6px var(--green-glow);
}

.step-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.step-text em { color: var(--muted2); font-style: normal; }
.step-text strong { color: var(--text); font-weight: 600; }

/* ─── Banners ────────────────────────────────────────────────────────────────── */
.banner {
  border-radius: 10px; padding: 12px 16px;
  display: none; align-items: center; gap: 14px;
  animation: slideDown .2s ease;
}
@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.banner.show { display: flex; }

.banner-icon {
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 12px; font-weight: 800; color: white;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.banner-body { flex: 1; }
.banner-body strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.banner-body span   { font-size: 12px; color: var(--muted2); }
.banner-close {
  background: transparent; border: none;
  color: var(--muted); cursor: pointer; font-size: 16px;
  transition: color .15s; flex-shrink: 0;
}
.banner-close:hover { color: var(--text); }

.banner-internet { background: #140c00; border: 1px solid rgba(255,107,53,.35); }
.banner-internet .banner-icon { background: var(--orange); }
.banner-internet strong { color: var(--orange); }

.banner-admin { background: #08112a; border: 1px solid rgba(79,142,247,.3); }
.banner-admin .banner-icon { background: var(--blue); font-size: 10px; font-weight: 900; }
.banner-admin strong { color: var(--blue); font-size: 9px; text-transform: uppercase; letter-spacing: .6px; }
.banner-admin .banner-body span { font-size: 13px; color: var(--text); }

.banner-limite { background: #140c00; border: 1px solid rgba(255,107,53,.35); }
.banner-limite .banner-icon { background: var(--orange); }
.banner-limite strong { color: var(--orange); }

/* ─── Toasts ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px; pointer-events: none;
}

.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 11px; padding: 13px 15px;
  display: flex; align-items: flex-start; gap: 11px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s cubic-bezier(.34,1.56,.64,1);
  pointer-events: all;
}
@keyframes toastIn {
  from { transform: translateX(24px) scale(.96); opacity: 0; }
  to   { transform: translateX(0)    scale(1);   opacity: 1; }
}

.toast-info   { border-left: 3px solid var(--blue); }
.toast-aviso  { border-left: 3px solid var(--orange); }
.toast-erro   { border-left: 3px solid var(--red); }
.toast-ok     { border-left: 3px solid var(--green); }

.toast-icon  { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.toast-body  { flex: 1; min-width: 0; }
.toast-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 3px;
}
.toast-info  .toast-title { color: var(--blue); }
.toast-aviso .toast-title { color: var(--orange); }
.toast-erro  .toast-title { color: var(--red); }
.toast-ok    .toast-title { color: var(--green); }
.toast-msg   { font-size: 12px; color: var(--text); line-height: 1.5; }
.toast-close {
  background: transparent; border: none;
  color: var(--muted); cursor: pointer; font-size: 14px;
  flex-shrink: 0; transition: color .15s;
}
.toast-close:hover { color: var(--text); }

/* ─── Etiquetas ──────────────────────────────────────────────────────────────── */
.etiqueta {
  display: inline-block; padding: 2px 9px;
  border-radius: 5px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.etiqueta.vai_pagar         { background: #03180d; color: #4ade80; border: 1px solid #14532d; }
.etiqueta.pagou             { background: #051128; color: #60a5fa; border: 1px solid #1e3a8a; }
.etiqueta.sem_interesse     { background: #1a0808; color: #f87171; border: 1px solid #7f1d1d; }
.etiqueta.aguarda_atendente { background: #1a1000; color: #fbbf24; border: 1px solid #78350f; }
.etiqueta.sem_etiqueta      { background: var(--bg4); color: var(--muted2); border: 1px solid var(--border2); }
.etiqueta-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ─── Filtros ────────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--border2);
  background: transparent; color: var(--muted2);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.filter-btn:hover  { color: var(--text); border-color: var(--green-dark); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10; border-color: transparent; font-weight: 600;
}

/* ─── Clientes ───────────────────────────────────────────────────────────────── */
.clientes-lista { display: flex; flex-direction: column; gap: 8px; }

.cliente-row {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 18px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  transition: border-color .2s, transform .15s;
}
.cliente-row:hover { border-color: var(--border2); transform: translateX(2px); }

.cliente-nome   { font-weight: 600; font-size: 13px; flex: 1; min-width: 100px; }
.cliente-numero { font-size: 11px; color: var(--muted2); font-family: 'SF Mono', monospace; }
.cliente-msg    {
  font-size: 12px; color: var(--muted2);
  flex: 2; min-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.etiqueta-select {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.etiqueta-select:focus { outline: none; border-color: var(--green); }

.empty-state { color: var(--muted); font-size: 13px; text-align: center; padding: 44px 20px; }

/* ─── Cards Editor ───────────────────────────────────────────────────────────── */
#cardsLista { display: flex; flex-direction: column; gap: 10px; }

.card-editor {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.card-editor:hover { border-color: var(--border2); }

.card-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg3);
}

.card-editor-id {
  font-size: 10px; font-family: 'SF Mono', monospace;
  color: var(--muted2); text-transform: uppercase; letter-spacing: 1.2px;
  display: flex; align-items: center; gap: 7px;
}

.card-editor-actions { display: flex; gap: 6px; }

.btn-edit {
  padding: 4px 12px; font-size: 11.5px; border-radius: 5px;
  border: 1px solid rgba(37,211,102,.3); background: transparent;
  color: var(--green); cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-edit:hover { background: var(--green-dim); }

.btn-save {
  padding: 4px 12px; font-size: 11.5px; border-radius: 5px;
  border: none; background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10; cursor: pointer; font-weight: 600;
  transition: all .15s; font-family: inherit;
}
.btn-save:hover:not(:disabled) { box-shadow: 0 2px 8px var(--green-glow); }
.btn-save:disabled { opacity: .4; cursor: not-allowed; }

.btn-cancel {
  padding: 4px 12px; font-size: 11.5px; border-radius: 5px;
  border: 1px solid var(--border2); background: transparent;
  color: var(--muted2); cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-cancel:hover { border-color: var(--red); color: var(--red); }

.btn-delete {
  padding: 4px 12px; font-size: 11.5px; border-radius: 5px;
  border: 1px solid rgba(255,71,87,.2); background: transparent;
  color: var(--red); cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-delete:hover { background: rgba(255,71,87,.1); border-color: var(--red); }

.card-view { padding: 14px 16px; }
.card-view-titulo { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.card-view-texto  { font-size: 12.5px; color: var(--muted2); line-height: 1.6; margin-bottom: 9px; }
.card-view-triggers { display: flex; flex-wrap: wrap; gap: 4px; }

.trigger-tag {
  background: var(--bg4); color: var(--green);
  font-size: 11px; padding: 2px 7px;
  border-radius: 5px; border: 1px solid rgba(37,211,102,.15);
  font-family: 'SF Mono', monospace;
}

.card-form {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 14px;
}

.card-saved-msg {
  background: #03180d; color: #4ade80;
  border-top: 1px solid #14532d;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
}

.cards-toolbar { display: flex; gap: 10px; margin-bottom: 2px; }

/* ─── Opções Editor ──────────────────────────────────────────────────────────── */
.opcoes-editor { display: flex; flex-direction: column; gap: 7px; margin-bottom: 6px; }
.opcoes-vazio  { font-size: 12px; color: var(--muted); font-style: italic; padding: 6px 0; }

.opcao-row { display: flex; align-items: center; gap: 7px; }

.opcao-num {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10; font-size: 10px; font-weight: 800;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.opcao-label-input { flex: 1; min-width: 0; }

.opcao-dest-select {
  flex: 1; min-width: 0;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--text); font-size: 13px;
  padding: 9px 10px; cursor: pointer; font-family: inherit;
}
.opcao-dest-select:focus { outline: none; border-color: var(--green); }

.opcao-del-btn {
  width: 28px; height: 28px; background: transparent;
  border: 1px solid rgba(255,71,87,.2); border-radius: 6px;
  color: var(--red); cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all .15s;
}
.opcao-del-btn:hover { background: rgba(255,71,87,.1); border-color: var(--red); }

.btn-add-opcao {
  padding: 6px 12px; border: 1px dashed rgba(37,211,102,.3);
  background: transparent; color: var(--green); border-radius: 6px;
  font-size: 12px; cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-add-opcao:hover { background: var(--green-dim); border-color: var(--green); }

.card-view-opcoes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.opcao-preview-tag {
  background: var(--green-dim); border: 1px solid rgba(37,211,102,.12);
  color: var(--text); font-size: 11px; padding: 2px 9px; border-radius: 5px;
}
.opcao-arrow { color: var(--green); font-weight: 700; }

/* ─── Logs ───────────────────────────────────────────────────────────────────── */
.logs-container {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px; min-height: 400px; max-height: 60vh;
  overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

.log-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 44px; }
.log-entry {
  background: var(--bg3); border-radius: 8px;
  padding: 9px 13px; font-size: 12px;
  border-left: 3px solid var(--green-dark);
}
.log-entry.assistente { border-left-color: var(--purple); }
.log-entry.handoff    { border-left-color: var(--orange); }
.log-time    { color: var(--muted); font-size: 10px; }
.log-contact { color: var(--green); font-weight: 700; margin-top: 2px; }
.log-msg     { color: var(--text); margin-top: 2px; }
.log-reply   { color: var(--muted2); font-style: italic; margin-top: 2px; font-size: 11px; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}

.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s cubic-bezier(.34,1.2,.64,1);
}
.modal h3 { font-size: 15px; font-weight: 700; }

.modal-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); width: min(540px, 95vw);
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s cubic-bezier(.34,1.2,.64,1);
}

@keyframes modalIn {
  from { transform: scale(.95) translateY(10px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 15px; font-weight: 700; }

.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; line-height: 1;
  padding: 4px 7px; border-radius: 6px; transition: all .15s;
}
.modal-close:hover { background: var(--bg4); color: var(--text); }

.modal-body { padding: 20px 24px; }

/* ─── Auth ───────────────────────────────────────────────────────────────────── */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; overflow: auto;
  background: radial-gradient(ellipse at 60% 20%, rgba(37,211,102,.04) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(79,142,247,.04) 0%, transparent 50%),
              var(--bg);
}

.auth-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 38px 34px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 18px;
}

.auth-logo {
  display: flex; align-items: center;
  justify-content: center; margin-bottom: 0;
}
.auth-logo-img {
  width: 180px; height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(37,211,102,.6));
}
.auth-logo-text {
  font-size: 26px; font-weight: 800; letter-spacing: -0.8px;
  background: linear-gradient(90deg, var(--green), #80ffb0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.auth-tagline { text-align: center; color: var(--muted2); font-size: 13.5px; margin-top: -8px; }

.auth-tabs {
  display: flex; background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; gap: 3px;
}
.auth-tab {
  flex: 1; padding: 8px; border: none; border-radius: 7px;
  background: transparent; color: var(--muted2);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.auth-tab.active {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10; box-shadow: 0 2px 6px var(--green-glow);
}

.auth-form { display: flex; flex-direction: column; gap: 13px; }

.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label {
  font-size: 11px; font-weight: 700;
  color: var(--muted2); text-transform: uppercase; letter-spacing: .6px;
}
.auth-field input {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 9px; color: var(--text); font-size: 14px;
  padding: 10px 13px; transition: all .15s;
  width: 100%; font-family: inherit;
}
.auth-field input:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}
.auth-field input::placeholder { color: var(--muted); }

.auth-error { color: var(--red); font-size: 13px; min-height: 18px; text-align: center; }

.auth-btn {
  padding: 11px; border: none; border-radius: 9px;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #0a1a10; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .15s; width: 100%;
  font-family: inherit; box-shadow: 0 3px 10px var(--green-glow);
  letter-spacing: -.1px;
}
.auth-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--green), #50ff90);
  box-shadow: 0 6px 20px var(--green-glow);
  transform: translateY(-1px);
}
.auth-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ─── Admin Panel ────────────────────────────────────────────────────────────── */
.admin-search-bar { margin-bottom: 10px; }

.admin-table-wrap {
  overflow-x: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.admin-table th {
  padding: 12px 14px; text-align: left;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted2);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%);
  white-space: nowrap;
}

.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.015); }
.admin-table tr.row-inactive td { opacity: .45; }

.td-name  { font-weight: 600; }
.td-email { color: var(--muted2); font-family: 'SF Mono', monospace; font-size: 11.5px; }
.td-date  { color: var(--muted2); font-size: 11.5px; white-space: nowrap; }
.td-actions { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

.bot-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 5px; white-space: nowrap;
}
.bot-badge.conectado    { background: #03180d; color: #4ade80; border: 1px solid #14532d; }
.bot-badge.conectando   { background: #1a1000; color: #fbbf24; border: 1px solid #78350f; }
.bot-badge.reconectando { background: #1a1000; color: var(--orange); border: 1px solid rgba(255,107,53,.4); }
.bot-badge.desconectado { background: var(--bg4); color: var(--muted); border: 1px solid var(--border2); }

.estado-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.estado-badge.ativo   { background: #03180d; color: #4ade80; border: 1px solid #14532d; }
.estado-badge.inativo { background: var(--bg4); color: var(--muted); border: 1px solid var(--border2); }

.admin-flag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.admin-flag.sim { background: rgba(251,191,36,.08); color: #fbbf24; border: 1px solid rgba(251,191,36,.25); }
.admin-flag.nao { background: var(--bg4); color: var(--muted); border: 1px solid var(--border2); }

.trial-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.trial-badge.ok      { background: #03180d; color: #4ade80; border: 1px solid #14532d; }
.trial-badge.baixo   { background: #1a1000; color: #fbbf24; border: 1px solid #78350f; }
.trial-badge.esgotado{ background: #1a0808; color: #f87171; border: 1px solid #7f1d1d; }

.plan-badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.plan-badge.ativo   { background: #03180d; color: #4ade80; border: 1px solid #14532d; }
.plan-badge.inativo { background: #1a0808; color: #f87171; border: 1px solid #7f1d1d; }

.plan-nome-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  background: rgba(79,142,247,.1); color: #93c5fd; border: 1px solid rgba(79,142,247,.25);
}

.action-btn {
  padding: 3px 9px; font-size: 11px; border-radius: 5px;
  border: 1px solid var(--border2); background: transparent;
  color: var(--muted2); cursor: pointer; white-space: nowrap;
  transition: all .15s; font-family: inherit;
}
.action-btn:hover              { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.action-btn.admin-toggle:hover { border-color: #fbbf24; color: #fbbf24; background: rgba(251,191,36,.06); }
.action-btn.danger-light       { border-color: rgba(255,107,53,.3); color: var(--orange); }
.action-btn.danger-light:hover { background: rgba(255,107,53,.1); border-color: var(--orange); }
.action-btn.danger             { border-color: rgba(255,71,87,.2); color: var(--red); }
.action-btn.danger:hover       { background: rgba(255,71,87,.1); border-color: var(--red); }

.admin-code {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 14px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px; color: var(--green);
}

/* ─── Upload de comprovativo ─────────────────────────────────────────────── */
.proof-upload-label {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border: 1.5px dashed var(--border2);
  border-radius: 9px; padding: 14px; cursor: pointer;
  color: var(--muted2); font-size: 13px; font-weight: 500;
  transition: all .15s; text-align: center;
}
.proof-upload-label:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.proof-upload-label.has-file { border-color: var(--green); color: var(--green); border-style: solid; }

.msg-send-card { max-width: 620px; }
.msg-feedback  { font-size: 13px; font-weight: 600; padding: 11px 15px; border-radius: 8px; }
.msg-feedback.ok   { background: #03180d; color: #4ade80; border: 1px solid #14532d; }
.msg-feedback.erro { background: #1a0808; color: #f87171; border: 1px solid #7f1d1d; }

/* ─── RESPONSIVO MOBILE ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Body: permite scroll vertical em mobile */
  body { height: auto; overflow-y: auto; overflow-x: hidden; }

  /* Layout principal: empilha sidebar em cima do conteudo */
  .app { flex-direction: column; height: auto; min-height: 100vh; }

  /* Sidebar vira barra horizontal no topo */
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 0 10px;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    overflow-x: auto;
    gap: 0;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar::-webkit-scrollbar { display: none; }

  /* Esconde elementos da sidebar que nao cabem na barra horizontal */
  .logo            { display: none; }
  .user-info       { display: none; }
  .credits-section { display: none !important; }
  /* Esconde o botao + Comprar mensagens na barra mobile */
  .sidebar > button { display: none !important; }

  .admin-badge     { display: none; }

  /* Sidebar-footer: mostrar apenas o botao Sair na barra mobile */
  .sidebar-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    padding: 0 0 0 6px;
    border-top: none;
    flex-shrink: 0;
    gap: 4px;
  }
  .sidebar-footer .status-badge { display: none; }
  .sidebar-footer .admin-link   { display: none; }
  .sidebar-footer .grupo-link   { display: none; }

  /* Link do grupo some da barra compacta, aparece como banner dentro do Painel */
  .grupo-banner-mobile { display: flex !important; }

  /* Nav vira horizontal */
  .nav {
    flex-direction: row;
    flex: 1;
    gap: 2px;
    margin-top: 0;
    overflow-x: auto;
    padding: 8px 0;
  }
  .nav::-webkit-scrollbar { display: none; }

  .nav-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 12.5px;
    border-radius: 8px;
    text-align: center;
  }

  /* Conteudo principal: full width, scroll livre */
  .main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    gap: 14px;
    height: auto;
  }

  /* Titulos de pagina menores */
  .page-header h1 { font-size: 18px; }

  /* Stats: 2 colunas em vez de 4 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 22px !important; }

  /* Cards de planos: 1 coluna */
  .plans-grid { grid-template-columns: 1fr !important; }

  /* Conexao WhatsApp: empilha vertical */
  .connection-layout {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .qr-column, .info-column { width: 100% !important; }

  /* Afiliados: empilha vertical */
  #afiliadosTopGrid { grid-template-columns: 1fr !important; }

  /* Banners */
  .banner { padding: 10px 14px; }

  /* Formularios e cards: max-width livre */
  .card { max-width: 100% !important; }

  /* Modais: full width em mobile */
  .modal {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    margin: 16px !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Tabelas admin: scroll horizontal */
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Logs */
  .logs-container { max-height: 60vh; }

  /* Clientes lista */
  .clientes-lista { gap: 10px; }
  .cliente-card { padding: 12px 14px; }

  /* Filtros */
  .filter-bar { flex-wrap: wrap; gap: 6px; }
  .filter-btn { font-size: 11px; padding: 5px 12px; }
}

/* Tablet: sidebar mais estreita */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 180px; }
  .main { padding: 20px 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Auth page (login) responsivo */
@media (max-width: 480px) {
  .auth-body {
    padding: 16px;
    align-items: flex-start;
    padding-top: 40px;
  }
  .auth-container {
    width: 100% !important;
    padding: 24px 20px !important;
    border-radius: 14px !important;
  }
  .auth-logo-img  { width: 140px !important; height: auto !important; }
}
