/* ===== Identidade Explosion Digital — dark navy + azul elétrico ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #07091a;
  --surface: #0a0e22;
  --panel: #0b1026;
  --card: #101428;
  --card-hover: #161c38;
  --border: #1e2840;
  --border-soft: rgba(255,255,255,.06);
  --accent: #003BFF;
  --accent-h: #2b56ff;
  --accent-d: #0028CC;
  --accent-dim: rgba(0,59,255,.14);
  --accent-glow: rgba(0,59,255,.30);
  --text: #ffffff;
  --text-dim: rgba(255,255,255,.62);
  --muted: rgba(255,255,255,.40);
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --bubble-me: #17255c;
  --bubble-them: #151a30;
  --border2: var(--border);
  --accent-dark: var(--accent);
}
body {
  font-family: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#app { display: grid; grid-template-columns: 280px 340px 1fr; grid-template-rows: 100vh; height: 100vh; overflow: hidden; }
#accounts, #chats, #conversation { min-height: 0; height: 100vh; overflow: hidden; }

.col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.col-head h1 { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: .2px; }
.col-head h2 { font-size: 15px; font-weight: 700; }
.col-head .sub { font-size: 12px; color: var(--muted); }
.brand-logo { height: 26px; width: auto; display: block; filter: brightness(0) invert(1); }

/* Coluna SDRs */
#accounts { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
#account-list { flex: 1; overflow-y: auto; min-height: 0; }
.account {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}
.account:hover { background: var(--card-hover); }
.account.active { background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.connected { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,.6); }
.dot.connecting, .dot.qr { background: var(--yellow); }
.dot.disconnected, .dot.logged_out { background: var(--red); }
.account .info { flex: 1; min-width: 0; }
.account .info .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .info .meta { font-size: 12px; color: var(--muted); }
.account .qr-badge { font-size: 11px; background: var(--yellow); color: #2a1e00; padding: 2px 7px; border-radius: 8px; font-weight: 700; }

#btn-add {
  width: 34px; height: 34px; border: none; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 20px; cursor: pointer; line-height: 1; transition: background .15s;
}
#btn-add:hover { background: var(--accent-h); }
.disclaimer { padding: 10px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }

/* Barra de usuário */
.user-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; color: var(--text-dim); }
.user-info .urole { font-size: 10px; text-transform: uppercase; font-weight: 800; letter-spacing: .5px; padding: 2px 7px; border-radius: 6px; background: var(--accent); color: #fff; }
.user-info .urole.sdr { background: #33405e; }
.user-actions { display: flex; gap: 6px; }
.user-actions button { border: none; background: transparent; font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--text-dim); }
.user-actions button:hover { background: var(--accent-dim); }

/* Conectar meu WhatsApp (SDR) */
.connect-cta { margin: 24px 16px; text-align: center; }
.connect-cta button { border: none; background: var(--accent); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.connect-cta button:hover { background: var(--accent-h); }
.connect-cta p { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

/* Coluna conversas */
#chats { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.search { padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--border); }
.search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; font-size: 13px; color: var(--text); font-family: inherit; }
.search input::placeholder { color: var(--muted); }
#chat-list { flex: 1; overflow-y: auto; min-height: 0; }
.chat {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}
.chat:hover { background: var(--card-hover); }
.chat.active { background: var(--accent-dim); }
.chat .avatar {
  width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-d));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 14px;
}
.chat .body { flex: 1; min-width: 0; }
.chat .row { display: flex; justify-content: space-between; gap: 8px; }
.chat .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .name .chat-phone { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.chat .time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.chat .preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .badge { background: var(--accent); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; min-width: 20px; text-align: center; font-weight: 700; }
.stale .time { color: var(--red); font-weight: 700; }

/* Conversa */
#conversation { display: flex; flex-direction: column; background: var(--surface); }
#messages {
  flex: 1; overflow-y: auto; min-height: 0; padding: 18px 8%;
  display: flex; flex-direction: column; gap: 4px;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(0,59,255,.06), transparent 60%),
    var(--bg);
}
.msg { max-width: 65%; padding: 7px 11px 8px; border-radius: 10px; font-size: 14px; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.msg.them { background: var(--bubble-them); align-self: flex-start; border-top-left-radius: 2px; }
.msg.me { background: var(--bubble-me); align-self: flex-end; border-top-right-radius: 2px; }
.msg .sender { font-size: 12px; font-weight: 700; color: var(--accent-h); margin-bottom: 2px; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; color: #eef1f8; }
.msg .t { font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px; }
.empty-hint { margin: auto; color: var(--muted); font-size: 14px; text-align: center; }
.day-sep { align-self: center; background: var(--card); color: var(--text-dim); font-size: 11px; padding: 4px 12px; border-radius: 10px; margin: 8px 0; }

.media-img { max-width: 280px; max-height: 320px; border-radius: 8px; cursor: pointer; display: block; }
.media-sticker { width: 120px; height: 120px; object-fit: contain; }
.media-vid { max-width: 300px; max-height: 340px; border-radius: 8px; display: block; }
.media-audio { width: 240px; height: 40px; margin: 2px 0; }
.media-doc { display: inline-block; padding: 8px 12px; background: rgba(255,255,255,.06); border-radius: 8px; color: #cdd6ff; text-decoration: none; font-size: 13px; }
.media-doc:hover { background: rgba(255,255,255,.12); }
.media-fail { display: inline-block; font-size: 12px; color: var(--muted); font-style: italic; padding: 8px 0; }
.msg .media-img + .text, .msg .media-vid + .text { margin-top: 4px; }

#composer { display: flex; gap: 8px; padding: 10px 14px; background: var(--panel); border-top: 1px solid var(--border); }
#composer input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: 22px; font-size: 14px; color: var(--text); font-family: inherit; }
#composer input::placeholder { color: var(--muted); }
#btn-send { border: none; background: var(--accent); color: #fff; padding: 0 20px; border-radius: 22px; cursor: pointer; font-size: 14px; font-weight: 600; }
#btn-send:hover { background: var(--accent-h); }
#btn-new-chat { border: 1px solid var(--accent); background: transparent; color: var(--accent-h); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
#btn-new-chat:hover { background: var(--accent-dim); }

/* Modais */
.modal { position: fixed; inset: 0; background: rgba(3,5,15,.7); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: var(--card); border: 1px solid var(--border); padding: 24px; border-radius: 14px; width: 360px; max-width: 90vw; text-align: center; color: var(--text); }
.modal-box h3 { margin-bottom: 6px; }
.modal-box h4 { color: var(--text); }
.modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
#qr-img { width: 240px; height: 240px; border-radius: 8px; background: #fff; padding: 6px; }
.qr-steps { text-align: left; font-size: 13px; color: var(--text-dim); margin: 14px 0; padding-left: 20px; line-height: 1.7; }
.modal-box label { display: block; text-align: left; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.modal-box input, .modal-box textarea, .modal-box select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button, .btn-close, #add-confirm, #new-confirm { flex: 1; padding: 11px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn-close { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
#add-confirm, #new-confirm { background: var(--accent); color: #fff; margin-top: 16px; }
#add-confirm:hover, #new-confirm:hover { background: var(--accent-h); }

/* Lista de usuários / acessos */
.users-list { text-align: left; max-height: 220px; overflow-y: auto; }
.user-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.user-item .u-role { font-size: 10px; text-transform: uppercase; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: #fff; margin-left: 6px; }
.user-item .u-role.sdr { background: #33405e; }
.user-item button { border: none; background: transparent; color: var(--red); cursor: pointer; font-size: 13px; }
.user-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.user-form input, .user-form select { padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface); color: var(--text); font-family: inherit; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--border); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 100; }
#toast.show { opacity: 1; }

#btn-audit { border: 1px solid var(--accent); background: transparent; color: var(--accent-h); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; font-weight: 600; }
#btn-audit:hover { background: var(--accent); color: #fff; }

/* Auditoria */
.audit-box { background: var(--card); border: 1px solid var(--border); border-radius: 14px; width: 900px; max-width: 94vw; height: 84vh; display: flex; flex-direction: column; overflow: hidden; color: var(--text); }
.audit-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.audit-head h3 { font-size: 17px; font-weight: 800; }
.audit-summary { font-size: 13px; color: var(--muted); }
.audit-head .btn-close { flex: none; width: auto; padding: 8px 16px; }
.audit-legend { padding: 8px 20px; font-size: 12px; color: var(--text-dim); background: var(--surface); border-bottom: 1px solid var(--border); }
.audit-body { flex: 1; overflow-y: auto; padding: 8px 12px; }
.audit-kpis { display: flex; gap: 12px; padding: 12px; flex-wrap: wrap; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; flex: 1; min-width: 130px; }
.kpi .v { font-size: 24px; font-weight: 800; color: #fff; }
.kpi .l { font-size: 12px; color: var(--muted); }
.lead-row { display: grid; grid-template-columns: 1fr 90px 150px 44px; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.lead-row:hover { background: var(--card-hover); }
.lead-row .lname { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-row .lmeet { font-size: 12px; color: var(--muted); }
.lead-dots { display: flex; gap: 3px; font-size: 13px; }
.lead-pct { font-weight: 800; text-align: right; font-size: 14px; }
.pct-hi { color: var(--green); } .pct-mid { color: var(--yellow); } .pct-lo { color: var(--red); }
.lead-detail { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 20px; }
.detail-point { display: flex; gap: 8px; padding: 5px 0; font-size: 13px; align-items: baseline; }
.detail-point .dp-icon { flex: none; }
.detail-point .dp-label { font-weight: 700; min-width: 150px; color: var(--text); }
.detail-point .dp-reason { color: var(--text-dim); }
.detail-point .dp-ev { color: var(--accent-h); font-style: italic; }

/* Dashboard inicial */
#home { position: fixed; left: 280px; top: 0; right: 0; bottom: 0; background:
  radial-gradient(900px 500px at 100% -10%, rgba(0,59,255,.08), transparent 55%), var(--bg);
  overflow-y: auto; padding: 32px 36px; z-index: 6; }
.home-head { display: flex; align-items: center; gap: 16px; }
.home-head img.brand-logo { height: 34px; }
.home-head .htxt h1 { font-size: 22px; font-weight: 800; color: #fff; }
.home-head .htxt .sub { font-size: 13px; color: var(--muted); }
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; margin-top: 26px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-top .who { display: flex; align-items: center; gap: 10px; }
.card-top .who .name { font-size: 16px; font-weight: 700; }
.card-nota { text-align: center; }
.card-nota .n { font-size: 34px; font-weight: 800; line-height: 1; }
.card-nota .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.nota-hi { color: var(--green); } .nota-mid { color: var(--yellow); } .nota-lo { color: var(--red); }
.card-section { margin-top: 16px; }
.card-section .cs-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
.last10 { display: flex; gap: 5px; flex-wrap: wrap; }
.last10 .l10 { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; }
.l10.hi { background: var(--green); } .l10.mid { background: var(--yellow); color:#2a1e00; } .l10.lo { background: var(--red); } .l10.none { background: #232a44; color: var(--muted); }
.least-point { font-size: 15px; font-weight: 700; color: var(--red); }
.least-point .rate { font-size: 12px; font-weight: 400; color: var(--muted); }
.card-actions { display: flex; gap: 10px; margin-top: 20px; }
.card-actions button { flex: 1; padding: 10px; border-radius: 9px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; }
.card-actions .b-audit { background: var(--accent); color: #fff; }
.card-actions .b-audit:hover { background: var(--accent-h); }
.card-actions .b-open { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
.card-actions .b-open:hover { border-color: var(--accent); color: #fff; }
.card-offline { color: var(--muted); font-size: 13px; padding: 10px 0; }
.clickable-logo { cursor: pointer; }

/* scrollbar dark */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1c2440; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #26304f; }
::-webkit-scrollbar-track { background: transparent; }
