/* WhatsApp Hub · Pro Ocupacional — painel v2. CSS puro, sem build. */
:root {
  --navy: #0a1a44;
  --navy-2: #0f2a73;
  --blue: #0632b5;
  --blue-2: #2a4fcb;
  --blue-soft: #e8edfb;
  --green: #019040;
  --wa: #25d366;
  --green-soft: #e3f6ea;
  --amber: #e9a300;
  --amber-soft: #fff4d6;
  --red: #e11d48;
  --red-soft: #fde4ea;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e3e8f1;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #8a94a6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(10, 26, 68, .25);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 17px; }
h3 { font-size: 14.5px; }
p { margin: 0 0 10px; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--blue-soft); color: var(--blue); padding: 1px 6px; border-radius: 6px; }
pre.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: var(--navy); color: #e5ebff; padding: 16px 18px; border-radius: 12px; overflow: auto; margin: 0; white-space: pre; }
pre.code.log { max-height: 460px; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.lead { color: var(--ink-2); max-width: 760px; margin: 4px 0 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-2); margin-bottom: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 20px; }
.spacer { flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.error { color: var(--red); font-weight: 600; margin-top: 10px; min-height: 1em; }
.plain { list-style: none; padding: 0; margin: 0 0 12px; }
.plain li { padding: 4px 0; }

/* ---------- botões ---------- */
.btn { font: 600 13.5px var(--font); border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 9px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .08s, border-color .15s; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.btn:hover { border-color: #c9d2e3; background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--blue-2), var(--blue)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(6, 50, 181, .28); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.green { background: linear-gradient(135deg, var(--wa), var(--green)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(1, 144, 64, .25); }
.btn.warn { background: var(--amber-soft); border-color: #f1d28a; color: #7a5300; }
.btn.danger { background: var(--red-soft); border-color: #f5b8c6; color: #9f1239; }
.btn.danger.ghost { background: transparent; border-color: transparent; color: var(--red); box-shadow: none; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--blue-soft); border-color: transparent; }
.btn.ghost.light { color: #c7d2f5; border-color: rgba(255,255,255,.18); }
.btn.ghost.light:hover { background: rgba(255,255,255,.08); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn.icon { padding: 6px 9px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-hero { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #0b3fa8 100%); color: #fff; display: flex; align-items: center; padding: 64px; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; }
.orb.o1 { width: 420px; height: 420px; background: #2a4fcb; top: -120px; right: -80px; }
.orb.o2 { width: 360px; height: 360px; background: #019040; bottom: -140px; left: -60px; animation-delay: -5s; }
.orb.o3 { width: 220px; height: 220px; background: #25d366; top: 45%; left: 55%; opacity: .25; animation-delay: -9s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(20px, -26px); } }
.hero-in { position: relative; max-width: 520px; }
.hero-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #9fe8bb; background: rgba(37, 211, 102, .12); border: 1px solid rgba(37, 211, 102, .3); padding: 6px 12px; border-radius: 999px; margin-bottom: 18px; }
.login-hero h1 { font-size: 50px; line-height: 1.05; margin-bottom: 14px; }
.login-hero p { font-size: 16.5px; color: #c7d2f5; max-width: 460px; }
.hero-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.hero-points li { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(4px); }
.hero-points span { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; background: rgba(255,255,255,.1); border-radius: 12px; }
.hero-points b { display: block; font-size: 14.5px; }
.hero-points small { color: #aab8e8; font-size: 12.5px; }
.login-side { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 36px 38px; box-shadow: var(--shadow-lg); text-align: left; }
.login-logo { height: 58px; display: block; margin: 0 auto 22px; }
.login-card h2 { font-size: 24px; }
.login-card label { display: block; margin-top: 14px; font-weight: 600; font-size: 13px; }
.login-card .btn { margin-top: 22px; }
.login-foot { margin-top: 22px; text-align: center; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- inputs ---------- */
input, select, textarea { font: 14px var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(42, 79, 203, .15); }
input:disabled { background: #f1f4f9; }
textarea { resize: vertical; }
select.sel { width: auto; }
label { font-size: 13px; font-weight: 600; display: block; margin: 12px 0 0; }
label input, label select, label textarea { margin-top: 5px; font-weight: 400; }
label .hint { display: block; font-weight: 400; color: var(--ink-3); margin-top: 4px; font-size: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; margin: 14px 0 0; }
legend { font-weight: 700; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.check.big { font-size: 15px; margin-top: 16px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.radio-row.big { margin-top: 14px; }
.chip { position: relative; cursor: pointer; margin: 0; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span { display: inline-block; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 13px; background: #fff; transition: all .12s; }
.chip input:checked + span { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip:hover span { border-color: var(--blue-2); }
.switches { display: grid; gap: 8px; margin-top: 12px; }
.switch { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin: 0; font-weight: 400; background: #fff; }
.switch input { position: absolute; opacity: 0; }
.switch span { flex: 0 0 40px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 21px; }
.switch b { display: block; font-size: 13.5px; }
.switch small { color: var(--ink-3); }
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 14px; margin-top: 4px; }
.events .check { font-weight: 500; }
.events code { font-size: 11px; }
.groups-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin-top: 10px; background: #fff; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.groups-list:empty { display: none; }
.groups-list small { color: var(--ink-3); margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; font: 600 13px var(--font); padding: 8px 13px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--blue); color: #fff; }
.seg.small button { padding: 5px 10px; font-size: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 6px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; font: 600 13.5px var(--font); padding: 8px 12px; cursor: pointer; color: var(--ink-3); border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.on { display: block; }
.ia-test { margin-top: 10px; padding: 10px 14px; background: var(--blue-soft); border-radius: 10px; white-space: pre-wrap; font-size: 13.5px; }

/* ---------- layout ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--side) 1fr; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 18px 14px; }
.side-logo { background: #fff; border-radius: 14px; padding: 12px 14px; display: grid; place-items: center; }
.side-logo img { height: 44px; }
.side-title { padding: 14px 6px 10px; }
.side-title b { display: block; font-size: 16px; }
.side-title small { color: #9fb0e6; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 10px 12px; border-radius: 11px; font-weight: 600; font-size: 14px; color: #c7d2f5; transition: background .15s, color .15s; }
.side-nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--wa); }
.nav-badge { margin-left: auto; font: 700 11px var(--mono); color: #c7d2f5; background: rgba(255,255,255,.1); border-radius: 999px; padding: 1px 7px; }
.nav-badge:empty { display: none; }
.nav-badge.alert { background: var(--red); color: #fff; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 6px 0; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #9fb0e6; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.live.on i { background: var(--wa); box-shadow: 0 0 0 0 rgba(37, 211, 102, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }
.content { padding: 28px 32px 60px; min-width: 0; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }

/* ---------- cards / kpis ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpis:empty { display: none; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.kpi.accent::before { background: var(--green); }
.kpi.alert::before { background: var(--red); }
.kpi.info::before { background: var(--blue-2); }
.kpi .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.kpi .v { font-size: 26px; font-weight: 800; line-height: 1.15; margin: 4px 0 2px; }
.kpi .s { font-size: 12.5px; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- cards de sessão ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.scard { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.scard-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--blue-soft); color: var(--blue); flex: 0 0 auto; text-transform: uppercase; }
.avatar.group { border-radius: 50%; background: var(--green-soft); }
.scard-title { flex: 1; min-width: 0; }
.scard-title b { font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard-title small { color: var(--ink-2); font-family: var(--mono); font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 11.5px; background: #eef1f6; color: var(--ink-2); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.connected, .badge.ativo { background: var(--green-soft); color: var(--green); }
.badge.qrcode, .badge.pairing, .badge.starting, .badge.atrasado { background: var(--amber-soft); color: #8a5a00; }
.badge.qrcode i, .badge.starting i, .badge.pairing i, .badge.trabalhando i { animation: blink 1s infinite; }
.badge.error, .badge.disconnected, .badge.logged_out, .badge.parado { background: var(--red-soft); color: var(--red); }
.badge.trabalhando { background: var(--blue-soft); color: var(--blue); }
.badge.inativo { background: #eef1f6; color: var(--ink-3); }
@keyframes blink { 50% { opacity: .25; } }
.scard-meta { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.scard-meta .line { display: flex; gap: 8px; align-items: baseline; }
.scard-meta .line em { font-style: normal; color: var(--ink-3); flex: 0 0 76px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.scard-meta .line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-meta .err { color: var(--red); white-space: normal; }
.scard-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; bottom: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 230px; z-index: 5; padding: 4px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; font: 500 13.5px var(--font); border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--blue-soft); }
.menu button.danger { color: var(--red); }
.empty { text-align: center; padding: 60px 20px; max-width: 520px; margin: 20px auto; }
.empty-ico { font-size: 46px; margin-bottom: 10px; }

/* ---------- agentes ---------- */
.ag-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.ag-card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ag-card .scard-head { align-items: flex-start; }
.ag-trig { display: flex; flex-wrap: wrap; gap: 4px; }
.ag-trig code { font-size: 12px; }
.ag-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ag-stats div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.ag-stats b { display: block; font-size: 18px; font-weight: 800; }
.ag-stats span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ag-warn { font-size: 12.5px; background: var(--amber-soft); color: #7a5300; border-radius: 8px; padding: 6px 10px; }
.ag-brain { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.ag-calls { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.ag-call { display: flex; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.ag-call .ic { flex: 0 0 auto; }
.ag-call-top { display: flex; justify-content: space-between; gap: 8px; }
.ag-call-txt { color: var(--ink-2); }
.ag-call-rep { color: var(--green); font-size: 12.5px; margin-top: 2px; }
.cred { display: grid; gap: 10px; margin-top: 10px; }
.cred-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; }
.cred-row b { font-size: 12.5px; color: var(--ink-2); }
.cred-row code { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; }
.cred pre { margin: 8px 0 0; }
#agDetail .card { margin-top: 14px; }

/* ---------- escritório 3D ---------- */
.office3d { position: relative; height: 620px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: #0b1633; touch-action: none; }
.office3d canvas { display: block; width: 100% !important; height: 100% !important; }
.o3-labels { position: absolute; inset: 0; pointer-events: none; }
.o3-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #cfe3ff; font-weight: 600; }
.o3-hud { position: absolute; left: 14px; top: 14px; background: rgba(8, 15, 40, .74); color: #eaf2ff; border-radius: 12px; padding: 10px 14px; font-size: 12.5px; line-height: 1.5; backdrop-filter: blur(6px); max-width: calc(100% - 28px); }
.o3-hud-t { font-weight: 800; font-size: 14px; letter-spacing: .02em; }
.o3-leg { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.o3-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.o3-help { position: absolute; right: 14px; bottom: 12px; color: rgba(255,255,255,.8); font-size: 11.5px; background: rgba(8,15,40,.5); padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.o3-chip { font: 500 12px var(--font); color: #f8fafc; background: rgba(8, 15, 40, .74); border: 1px solid rgba(255, 255, 255, .16); padding: 3px 9px; border-radius: 999px; white-space: nowrap; display: flex; gap: 6px; align-items: center; transition: opacity .3s; }
.o3-chip-s { font-size: 13px; }
.o3-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.o3-hud.off { display: none; }
.o3-back { position: absolute; top: 12px; left: 12px; z-index: 4; display: none; font: 600 13px var(--font); border: 0; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.o3-back.on { display: inline-block; }
.o3-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(330px, calc(100% - 24px)); z-index: 4; background: rgba(8, 13, 32, .92); border: 1px solid rgba(125, 211, 252, .35); border-radius: 12px; color: #e2e8f0; font: 13px/1.45 var(--font); padding: 14px 16px; transform: translateX(calc(100% + 24px)); transition: transform .45s ease; overflow-y: auto; }
.o3-panel.on { transform: none; }
.o3p-head { display: flex; justify-content: space-between; align-items: center; }
.o3p-head b { font-size: 18px; font-weight: 700; color: #f8fafc; }
.o3p-st { font-size: 12px; padding: 2px 10px; border-radius: 999px; color: var(--c); border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.o3p-sub { color: #94a3b8; font-size: 12px; margin: 2px 0 12px; }
.o3p-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.o3p-kpis div { background: rgba(56, 189, 248, .08); border: 1px solid rgba(56, 189, 248, .2); border-radius: 8px; padding: 6px 8px; }
.o3p-kpis small { display: block; color: #94a3b8; font-size: 11px; }
.o3p-kpis b { font-size: 17px; font-weight: 700; color: #f0f9ff; }
.o3p-warn { margin-top: 10px; font-size: 12px; color: #fcd34d; background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .3); border-radius: 8px; padding: 6px 8px; }
.o3p-grp { border-top: 1px solid rgba(148, 163, 184, .18); padding-top: 10px; margin-top: 12px; }
.o3p-gh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.o3p-gh b { font-weight: 600; color: #f0f9ff; }
.o3p-live { font-size: 11px; color: #86efac; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.o3p-live i { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; }
.o3p-call { padding: 5px 0; }
.o3p-ct { color: #e2e8f0; font-size: 12.5px; }
.o3p-cm { color: #94a3b8; font-size: 11.5px; }
.o3p-empty { color: #64748b; font-size: 12px; }
.o3p-chart { border-top: 1px solid rgba(148, 163, 184, .18); margin-top: 12px; padding-top: 10px; }
.o3p-chart small { display: block; color: #94a3b8; font-size: 11px; margin-bottom: 4px; }

/* ---------- conversas ---------- */
.conv { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - 56px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.conv-side { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.conv-side-head { padding: 16px 16px 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.conv-side-head h1 { font-size: 20px; }
.conv-sessions { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: thin; }
.conv-sessions button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font: 600 12.5px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.conv-sessions button i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.conv-sessions button.connected i { background: var(--wa); }
.conv-sessions button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.search { padding: 0 16px 10px; }
.search input { border-radius: 999px; padding-left: 14px; }
.chat-list { flex: 1; overflow: auto; border-top: 1px solid var(--line); }
.chat-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 11px 16px; cursor: pointer; border-bottom: 1px solid var(--line); }
.chat-item:hover { background: var(--bg); }
.chat-item.active { background: var(--blue-soft); }
.chat-item .avatar { width: 40px; height: 40px; font-size: 13px; }
.chat-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .last { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .when { font: 11px var(--mono); color: var(--ink-3); align-self: start; }
.chat-item .unread { background: var(--wa); color: #fff; font: 700 10.5px var(--mono); border-radius: 999px; padding: 1px 6px; justify-self: end; }
.conv-pane { display: flex; flex-direction: column; min-height: 0; background: #eef2f8; background-image: radial-gradient(#d8dfeb 1px, transparent 1px); background-size: 18px 18px; }
.conv-title { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.conv-title b { display: block; }
.conv-title small { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }
.conv-title > div:nth-child(2) { flex: 1; min-width: 0; }
.conv-messages { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.conv-hint { margin: auto; color: var(--ink-3); text-align: center; }
.day { align-self: center; font: 600 11px var(--mono); color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin: 10px 0 4px; }
.msg { max-width: 68%; background: var(--card); border-radius: 14px 14px 14px 4px; padding: 8px 12px 6px; align-self: flex-start; box-shadow: 0 1px 2px rgba(15,23,42,.08); font-size: 14px; word-break: break-word; }
.msg.me { align-self: flex-end; background: #dcf8e5; border-radius: 14px 14px 4px 14px; }
.msg .who { font-size: 11.5px; font-weight: 700; color: var(--blue); margin-bottom: 2px; }
.msg .time { font: 10.5px var(--mono); color: var(--ink-3); text-align: right; margin-top: 2px; }
.msg img { max-width: 280px; max-height: 280px; display: block; border-radius: 8px; margin: 4px 0; }
.msg .media { font-size: 13px; color: var(--ink-2); margin: 2px 0; }
.msg .media a { color: var(--blue); }
.msg.revoked { opacity: .6; font-style: italic; }
.conv-composer { display: flex; gap: 10px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); }
.conv-composer input { border-radius: 999px; padding-left: 16px; }

/* ---------- tabelas ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.wrap { word-break: break-all; max-width: 360px; }
.tbl tr.err td { background: var(--red-soft); }
.tbl td.mono, .mono { font-family: var(--mono); font-size: 12px; }
.tbl input { padding: 6px 10px; font-size: 13px; }
.tbl .ev-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.tbl .ev-chips span { font: 500 11px var(--mono); background: var(--bg); border-radius: 6px; padding: 1px 6px; }
.ok-dot, .bad-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.ok-dot { background: var(--green); }
.bad-dot { background: var(--red); }
.ev-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.ev-list li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.ev-list code { flex: 0 0 150px; }

/* ---------- doc ---------- */
.doc h3 { margin: 22px 0 8px; }
.doc h3:first-child { margin-top: 0; }
.doc p { color: var(--ink-2); }
.doc pre.code { margin-bottom: 6px; }

/* ---------- modais ---------- */
.modal { position: fixed; inset: 0; background: rgba(10, 26, 68, .5); display: grid; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(3px); }
.modal-box { position: relative; background: var(--card); border-radius: 20px; padding: 26px 30px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-box.wide { width: min(780px, 100%); }
.modal-box h2 { font-size: 22px; }
.modal-box .x { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.modal-box .x:hover { color: var(--ink); }
.qr-box { width: min(840px, 100%); display: grid; grid-template-columns: 1fr 340px; gap: 26px; }
.qr-left h2 { word-break: break-all; }
.steps { padding-left: 20px; margin: 16px 0; display: grid; gap: 10px; }
.steps li::marker { font-family: var(--mono); font-weight: 700; color: var(--blue); }
.qr-right { display: grid; place-items: center; min-height: 340px; border: 1px dashed var(--line); border-radius: 14px; background: #fff; }
#qrArea { text-align: center; padding: 10px; }
#qrArea img { width: 300px; height: 300px; image-rendering: pixelated; border-radius: 8px; }
#qrArea .ok { font-size: 46px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 100; box-shadow: var(--shadow-lg); max-width: 90vw; border-left: 4px solid var(--wa); }
.toast.err { border-left-color: var(--red); }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } .qr-box { grid-template-columns: 1fr; } .ag-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; flex-direction: row; align-items: center; padding: 6px 8px; z-index: 30; }
  .side-logo, .side-title, .side-foot { display: none; }
  .side-nav { flex-direction: row; flex: 1; justify-content: space-around; margin: 0; }
  .side-nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 4px; }
  .nav-badge { position: absolute; top: 0; right: 4px; margin: 0; }
  .content { padding: 18px 16px 90px; }
  .conv { grid-template-columns: 1fr; height: auto; }
  .conv-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 50vh; }
  .conv-pane { min-height: 60vh; }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 36px 24px; }
  .login-hero h1 { font-size: 36px; }
  .msg { max-width: 88%; }
  .two { grid-template-columns: 1fr; }
  .cred-row { grid-template-columns: 1fr; }
  .office3d { height: 460px; }
}

/* ---------- conversas: emoji, anexos, áudio, reações ---------- */
.conv-pane { position: relative; }
.emoji-pop { position: absolute; left: 16px; bottom: 68px; z-index: 6; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 10px; width: min(340px, calc(100% - 32px)); max-height: 260px; overflow-y: auto; overflow-x: hidden; }
.emoji-pop .emoji-cat { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 6px 4px 2px; }
.emoji-pop .emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); }
.emoji-pop button { border: 0; background: transparent; font-size: 21px; padding: 4px; border-radius: 8px; cursor: pointer; line-height: 1.2; }
.emoji-pop button:hover { background: var(--blue-soft); }
.attach-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-top: 1px solid var(--line); font-size: 13px; }
.attach-bar img, .attach-bar video { height: 56px; width: 56px; object-fit: cover; border-radius: 8px; }
.attach-bar .doc { width: 56px; height: 56px; display: grid; place-items: center; background: var(--blue-soft); border-radius: 8px; font-size: 24px; }
.attach-bar b { display: block; }
.attach-bar small { color: var(--ink-3); }
.attach-bar .spacer { flex: 1; }
.msg audio { width: 260px; max-width: 100%; display: block; margin: 4px 0; }
.msg video { max-width: 280px; max-height: 280px; display: block; border-radius: 8px; margin: 4px 0; }
.msg img.sticker { max-width: 140px; max-height: 140px; }
.msg { position: relative; }
.msg .react-btn { position: absolute; top: -10px; right: -8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; width: 24px; height: 24px; font-size: 13px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.msg.me .react-btn { right: auto; left: -8px; }
.msg:hover .react-btn { opacity: 1; }
.msg .reacts { display: flex; gap: 4px; margin-top: 4px; }
.msg .reacts span { font-size: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.react-pop { position: absolute; z-index: 7; background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg); padding: 4px 6px; display: flex; gap: 2px; }
.react-pop button { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 3px 5px; border-radius: 999px; }
.react-pop button:hover { background: var(--blue-soft); transform: scale(1.2); }
#btnRec.rec { background: var(--red-soft); color: var(--red); animation: blink 1s infinite; }
#btnSound.off { opacity: .45; }
.conv-composer .btn.icon { font-size: 17px; padding: 6px 7px; flex: 0 0 auto; }
.conv-composer input { flex: 1; min-width: 80px; }
.conv-composer .btn.primary { flex: 0 0 auto; }

/* ---------- motor de conexão ---------- */
.engine-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.engine { position: relative; margin: 0; cursor: pointer; font-weight: 400; }
.engine input { position: absolute; opacity: 0; }
.engine div { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; height: 100%; transition: border-color .12s, background .12s; }
.engine b { display: block; font-size: 14px; margin-bottom: 2px; }
.engine small { color: var(--ink-3); font-size: 12px; line-height: 1.35; display: block; }
.engine input:checked + div { border-color: var(--blue); background: var(--blue-soft); }
.badge.engine-evo { background: #eaf3ff; color: #1d4ed8; }
.badge.engine-wpp { background: #eef1f6; color: var(--ink-2); }
@media (max-width: 860px) { .engine-row { grid-template-columns: 1fr; } }
