:root {
  --bg: #0b0b09;
  --bg-2: #100f0b;
  --surface: #16150f;
  --surface-2: #1d1b12;
  --line: #2c2920;
  --line-strong: #423c2c;
  --text: #f1eee3;
  --text-soft: #c3beae;
  --text-mute: #8f8a76;
  --gold: #e6b64c;
  --gold-2: #f7e09a;
  --gold-grad: linear-gradient(135deg, #f7e09a 0%, #e6b64c 45%, #c9902f 100%);
  --accent: #e6b64c;
  --accent-soft: rgba(230, 182, 76, .14);
  --danger: #e08072;
  --danger-soft: rgba(224, 128, 114, .14);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --glow: 0 0 24px rgba(230, 182, 76, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(230,182,76,.10), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(230,182,76,.05), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 28px 20px 80px; }

/* Cabeçalho */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .dot { display: none; }
.brand-logo { height: 46px; width: auto; filter: drop-shadow(0 0 10px rgba(230,182,76,.30)); }
.brand h1 {
  font-size: 20px; font-weight: 700; margin: 0; letter-spacing: 2px;
  background: linear-gradient(180deg, #ffffff, #b9b6ad 60%, #7d7a70);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand span { color: var(--gold); font-size: 12px; letter-spacing: .5px; }

/* Botões */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--text); border-radius: var(--radius);
  padding: 11px 18px; transition: all .14s;
}
.btn:hover { border-color: var(--gold); color: var(--gold-2); background: #23201533; }
.btn-primary {
  background: var(--gold-grad); border: none; color: #221a06; font-weight: 700;
  box-shadow: var(--glow);
}
.btn-primary:hover { filter: brightness(1.08); color: #221a06; }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-danger:hover { background: rgba(224,128,114,.22); color: #f0a99e; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-mute); padding-left: 4px; }
.btn-ghost:hover { background: transparent; color: var(--gold-2); }
.btn-block { width: 100%; }

/* Lista de agentes */
.agent-list { display: grid; gap: 12px; }
.agent-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; box-shadow: var(--shadow); transition: all .14s;
}
.agent-card:hover { border-color: var(--gold); box-shadow: var(--shadow), var(--glow); }
.agent-card .info h3 { margin: 0 0 3px; font-size: 16px; font-weight: 600; }
.agent-card .info p { margin: 0; color: var(--text-mute); font-size: 13px; }
.pill { font-size: 12px; padding: 4px 11px; border-radius: 20px; font-weight: 600; }
.pill.on { background: var(--accent-soft); color: var(--gold-2); border: 1px solid rgba(230,182,76,.35); }
.pill.off { background: #201e16; color: var(--text-mute); }

.empty { text-align: center; color: var(--text-mute); padding: 48px 20px; }

/* Formulário */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; color: var(--gold-2); }
.card .hint { color: var(--text-mute); font-size: 13px; margin: 0 0 18px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; font-weight: 500; }
.field .help { font-size: 12px; color: var(--text-mute); margin-top: 5px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 10px 12px;
}
input::placeholder, textarea::placeholder { color: #6f6b5c; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft);
}
select option { background: var(--surface); color: var(--text); }
textarea { resize: vertical; min-height: 84px; }

/* Interruptores (toggles) */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .lbl { font-size: 14px; }
.toggle-row .sub { font-size: 12px; color: var(--text-mute); }
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #3a352780; border: 1px solid var(--line-strong);
  border-radius: 20px; cursor: pointer; transition: background .15s;
}
.slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #d9d4c4; border-radius: 50%; transition: transform .15s;
}
.switch input:checked + .slider { background: var(--gold-grad); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(18px); background: #fff; }

/* Barra de ações */
.actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; }
.actions .spacer { flex: 1; }

/* Teste de conversa */
.test { margin-top: 8px; }
.chat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-height: 60px; margin-bottom: 12px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; margin-bottom: 8px; font-size: 14px; }
.msg.user { background: var(--gold-grad); color: #221a06; margin-left: auto; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.bot { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat .placeholder { color: var(--text-mute); font-size: 13px; text-align: center; }
.test-input { display: flex; gap: 10px; }
.test-input input { flex: 1; }

/* Aviso / erro */
.banner {
  border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; display: none;
}
.banner.show { display: block; }
.banner.ok { background: var(--accent-soft); color: var(--gold-2); border: 1px solid rgba(230,182,76,.3); }
.banner.err { background: var(--danger-soft); color: #f0a99e; border: 1px solid rgba(224,128,114,.3); }

.hidden { display: none !important; }
.webhook-box {
  background: var(--bg-2); border: 1px dashed var(--line-strong); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; word-break: break-all; color: var(--gold-2);
}

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 34px 30px; box-shadow: var(--shadow), var(--glow); width: 100%; max-width: 390px;
}
.login-logo { display: block; width: 190px; max-width: 70%; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 0 18px rgba(230,182,76,.35)); }
.login-title {
  text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 4px; margin: 0 0 4px;
  background: linear-gradient(180deg, #ffffff, #b9b6ad 55%, #6f6c62);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-sub { text-align: center; color: var(--gold); font-size: 12px; letter-spacing: 1px; margin: 0 0 22px; }
.login-card .btn-block { margin-top: 6px; }

/* Topo com ação de sair */
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Funil de vendas (Kanban) */
.funil-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 800px) { .funil-board { grid-template-columns: repeat(2, 1fr); } }
.funil-col { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 120px; }
.funil-col-head { font-size: 13px; font-weight: 600; color: var(--gold-2); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.funil-col-head span { font-size: 11px; color: var(--text-mute); font-weight: 400; }
.funil-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.funil-card b { font-size: 13px; }
.funil-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.funil-acoes { display: flex; gap: 4px; margin-top: 8px; }
.funil-acoes button { flex: 1; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text-soft); border-radius: 6px; padding: 3px; cursor: pointer; font-size: 13px; }
.funil-acoes button:hover { border-color: var(--gold); color: var(--gold-2); }

/* Cockpit do dia */
.cockpit-bloco { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.cockpit-bloco > b { display: block; font-size: 14px; color: var(--gold-2); margin-bottom: 8px; }
.cockpit-item { font-size: 13px; color: var(--text-soft); padding: 4px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Chip de anexo (assistente) */
.anexo-chip {
  display: inline-block; background: var(--accent-soft); color: var(--gold-2);
  border: 1px solid rgba(230,182,76,.35); border-radius: 14px;
  padding: 3px 10px; font-size: 12px; margin: 0 4px 4px 0;
}
.anexo-chip b { color: var(--danger); margin-left: 4px; }

/* Checkout público */
.checkout-wrap { max-width: 480px; margin: 0 auto; padding: 40px 20px 80px; }
.checkout-head { text-align: center; margin-bottom: 24px; }
.ck-planos { display: grid; gap: 14px; }
.ck-plano {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: all .14s;
}
.ck-plano:hover { border-color: var(--gold); box-shadow: var(--shadow), var(--glow); }
.ck-plano h3 { margin: 0 0 6px; font-size: 18px; color: var(--gold-2); }
.ck-preco { font-size: 30px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.ck-preco span { font-size: 14px; font-weight: 400; color: var(--text-mute); }
.ck-desc { color: var(--text-soft); font-size: 14px; margin: 0 0 12px; white-space: pre-line; }
.ck-tag { display: inline-block; background: var(--accent-soft); color: var(--gold-2); border: 1px solid rgba(230,182,76,.3); font-size: 12px; padding: 3px 10px; border-radius: 12px; margin-bottom: 16px; }
.ck-status { color: var(--gold-2); font-size: 13px; margin-top: 16px; }
.ck-cred { display: flex; gap: 14px; justify-content: center; margin-top: 14px; }
.ck-cred > div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 18px; }
.ck-cred span { display: block; font-size: 11px; color: var(--text-mute); }
.ck-cred b { font-size: 16px; color: var(--gold-2); }

/* Central de conversas (inbox) */
.inbox { display: grid; grid-template-columns: 320px 1fr; gap: 14px; margin-top: 12px; height: calc(100vh - 150px); min-height: 480px; }
@media (max-width: 720px) { .inbox { grid-template-columns: 1fr; height: auto; } }
.inbox-lista {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-y: auto; box-shadow: var(--shadow);
}
.inbox-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.sel { background: var(--accent-soft); }
.inbox-item-top { display: flex; justify-content: space-between; align-items: baseline; }
.inbox-item-top b { font-size: 14px; }
.inbox-item-top span { font-size: 11px; color: var(--text-mute); }
.inbox-item-sub { font-size: 12px; color: var(--text-mute); margin: 2px 0; display: flex; align-items: center; gap: 6px; }
.inbox-item-msg { font-size: 13px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 10px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.tag-ok { background: var(--accent-soft); color: var(--gold-2); border: 1px solid rgba(230,182,76,.3); }
.tag-warn { background: rgba(224,128,114,.16); color: #f0a99e; }
.inbox-chat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden;
}
.inbox-vazio { color: var(--text-mute); text-align: center; padding: 40px 20px; margin: auto; font-size: 14px; }
.inbox-chat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.inbox-chat-status { display: flex; align-items: center; gap: 10px; }
.inbox-msgs { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg-2); min-height: 200px; }
.bolha { max-width: 78%; padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; font-size: 14px; position: relative; word-wrap: break-word; }
.bolha.in { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.bolha.out { background: var(--gold-grad); color: #221a06; margin-left: auto; border-bottom-right-radius: 3px; font-weight: 500; }
.bolha-hora { display: block; font-size: 10px; opacity: .6; margin-top: 3px; text-align: right; }
.inbox-input { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.inbox-input input { flex: 1; }

/* Dashboard do dono */
.dash {
  background: linear-gradient(180deg, #1b190f, var(--surface));
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow), var(--glow);
}
.dash-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.dash-head h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--gold-2); }
.dash-head span { color: var(--text-mute); font-size: 13px; }
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 560px) { .dash-kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.kpi-n { font-size: 22px; font-weight: 700; color: var(--text); }
.kpi-l { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.dash-custo { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.dash-custo b { display: block; font-size: 18px; color: var(--gold-2); }

/* Termômetro de humor */
.humor { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.thermo {
  position: relative; width: 100%; height: 14px; border-radius: 20px;
  background: linear-gradient(90deg, var(--danger) 0%, #d8a531 50%, var(--gold) 100%);
  flex: 1; min-width: 200px;
}
.thermo .needle {
  position: absolute; top: -6px; width: 4px; height: 26px; border-radius: 3px;
  background: #fff; transform: translateX(-50%); box-shadow: 0 0 6px rgba(255,255,255,.6);
  transition: left .4s ease;
}
.humor-face { font-size: 40px; line-height: 1; }
.humor-index { font-size: 26px; font-weight: 700; color: var(--gold-2); }
.humor-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-mute); margin-top: 6px; }
.humor-counts { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.humor-counts .c { font-size: 13px; color: var(--text-soft); }
.humor-counts .c b { font-size: 18px; display: block; color: var(--text); }
.humor-spark { display: flex; gap: 4px; align-items: flex-end; height: 40px; margin-top: 14px; }
.humor-spark .bar { flex: 1; border-radius: 3px 3px 0 0; background: var(--line-strong); min-height: 3px; }
