:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --text: #1c2430;
  --muted: #6b7686;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-soft: #e6f4f2;
  --won: #15803d;
  --won-soft: #e8f6ec;
  --lost: #c2410c;
  --lost-soft: #fdf0e8;
  --warn: #b45309;
  --warn-soft: #fef6e4;
  --danger: #dc2626;
  --side: #102a2b;
  --side-text: #b9cfcd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 20px; }
.brand svg { width: 26px; height: 26px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 9px 12px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(20,184,166,.18); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot .who { color: #fff; font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.live.on::before { background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.topbar .grow { flex: 1; }
.content { padding: 20px 24px; flex: 1; min-width: 0; }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0d665f; }
.btn.won { background: var(--won); border-color: var(--won); color: #fff; }
.btn.lost { background: var(--surface); border-color: var(--lost); color: var(--lost); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=time], select, textarea {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 550; }
label.field > span { text-transform: none; }
[hidden] { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 5px 10px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 80px; align-items: flex-start; min-height: calc(100vh - 160px); }
.col { flex: 0 0 272px; background: #eceef2; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
.col-head { padding: 10px 12px 8px; border-bottom: 3px solid var(--accent-2); }
.col-head .name { font-weight: 650; display: flex; justify-content: space-between; gap: 6px; }
.col-head .meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; justify-content: space-between; }
.col-body { padding: 8px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.col.drag-over { background: #dff1ee; }
.deal { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; cursor: pointer; box-shadow: var(--shadow); }
.deal:hover { border-color: #b9c2cf; }
.deal.dragging { opacity: .4; }
.deal .t { font-weight: 600; line-height: 1.3; }
.deal .c { color: var(--muted); font-size: 12px; margin-top: 2px; }
.deal .b { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 6px; }
.deal .v { font-weight: 600; font-size: 13px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.act-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.act-pill.overdue { background: #fdecec; color: var(--danger); border-color: #f7caca; }
.act-pill.today { background: var(--won-soft); color: var(--won); border-color: #bfe5c9; }
.act-pill.none { background: var(--warn-soft); color: var(--warn); border-color: #f5dfae; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.tag.src { background: #eef2ff; color: #4338ca; border-color: #dfe3ff; }
.tag.won { background: var(--won-soft); color: var(--won); border-color: #bfe5c9; }
.tag.lost { background: var(--lost-soft); color: var(--lost); border-color: #f6d3bd; }
.tag.open { background: var(--accent-soft); color: var(--accent); border-color: #c4e6e1; }

.dropzones { position: fixed; left: 220px; right: 0; bottom: 0; display: none; gap: 12px; padding: 14px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(4px); border-top: 1px solid var(--border); z-index: 30; }
.dropzones.show { display: flex; }
.dz { flex: 1; border: 2px dashed; border-radius: 10px; text-align: center; padding: 18px; font-weight: 700; }
.dz.won { border-color: var(--won); color: var(--won); }
.dz.lost { border-color: var(--lost); color: var(--lost); }
.dz.del { border-color: #94a3b8; color: #64748b; flex: .5; }
.dz.over { background: var(--surface-2); transform: scale(1.02); }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }

/* ---------- Drawer / Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 40; display: flex; }
.drawer { margin-left: auto; width: min(760px, 100%); height: 100%; background: var(--bg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { background: var(--surface); padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { overflow-y: auto; padding: 16px 20px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; align-items: start; }
.modal { margin: auto; width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; }
.modal.wide { width: min(760px, calc(100% - 32px)); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { padding: 16px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px 20px; }
.modal-foot { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.x { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

.stagebar { display: flex; gap: 3px; margin-top: 12px; }
.stagebar button { flex: 1; border: 0; padding: 7px 6px; font-size: 11.5px; background: #e5e8ed; color: var(--muted); cursor: pointer; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stagebar button:first-child { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.stagebar button.past { background: #a7ddd6; color: #0b4f49; }
.stagebar button.cur { background: var(--accent); color: #fff; font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.section + .section { margin-top: 12px; }
.section h3 { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -4px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent-2); }
.timeline .dot.note { border-color: #f59e0b; }
.timeline .dot.won { border-color: var(--won); }
.timeline .dot.lost { border-color: var(--lost); }
.timeline .dot.conv { border-color: #6366f1; }
.timeline .when { font-size: 11.5px; color: var(--muted); }
.timeline .note-body { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; margin-top: 4px; white-space: pre-wrap; }

.act { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); font-size: 15px; flex: none; }
.act .body { flex: 1; min-width: 0; }
.act .title { font-weight: 600; }
.act.done .title { text-decoration: line-through; color: var(--muted); }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b6bfcc; background: var(--surface); cursor: pointer; flex: none; margin-top: 5px; display: grid; place-items: center; padding: 0; }
.check:hover { border-color: var(--won); }
.check.on { background: var(--won); border-color: var(--won); color: #fff; }
.check.on::after { content: "✓"; font-size: 12px; font-weight: 700; }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--won); font-weight: 600; }

/* ---------- Relatórios ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { background: #d1fae5; } 100% { background: var(--surface); } }
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rep-grid .full { grid-column: 1 / -1; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--surface-2); border-radius: 5px; height: 22px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent-2); border-radius: 5px; transition: width .4s ease; }
.bar-fill.alt { background: #6366f1; }
.bar-fill.lost { background: #f97316; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.funnel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.funnel .step { display: flex; justify-content: space-between; align-items: center; color: #fff; padding: 9px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; min-width: 220px; transition: width .4s ease; }
.funnel .conv { font-size: 11.5px; color: var(--muted); }
.chart svg { width: 100%; height: 220px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Config ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.stage-row { display: grid; grid-template-columns: 28px 1fr 110px auto; gap: 8px; align-items: center; padding: 6px 0; }
.code { font-family: Consolas, "SFMono-Regular", monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; word-break: break-all; }
pre.code { white-space: pre-wrap; max-height: 220px; overflow: auto; margin: 0; }
ol.steps { padding-left: 18px; line-height: 1.6; margin: 6px 0; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0b3b3a, #102a2b 60%, #0f172a); padding: 16px; }
.auth .card { width: min(380px, 100%); padding: 28px; }
.auth .brand { color: var(--text); padding: 0 0 16px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0f172a; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 360px; animation: pop .15s ease-out; cursor: pointer; }
.toast.err { background: #991b1b; }
.toast.lead { background: var(--accent); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .brand { padding: 0 10px 0 4px; }
  .nav { display: flex; overflow-x: auto; flex: 1 0 100%; order: 3; }
  .nav a span.lbl { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0 6px; }
  .dropzones { left: 0; }
  .drawer-body, .rep-grid, .grid2, .grid3 { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .bar-row { grid-template-columns: 100px 1fr 70px; }
}

/* ---------- Atribuição de anúncios ---------- */
.tag.plat-google { background: #e8f0fe; color: #1a56db; border-color: #cddcfb; }
.tag.plat-meta { background: #eef0ff; color: #3b49d6; border-color: #d9ddff; }
.deal .ad-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
textarea.code { min-height: 0; resize: vertical; }

/* ---------- Classificação SQL / MQL ---------- */
.tag.qual { font-weight: 700; letter-spacing: .02em; }
.tag.qual-sql { background: var(--won-soft); color: var(--won); border-color: #bfe5c9; }
.tag.qual-mql { background: var(--warn-soft); color: var(--warn); border-color: #f5dfae; }
.deal .t .tag.qual { vertical-align: 1px; }
.chip input + * { pointer-events: none; }

/* ---------- WhatsApp (portal de atendimento, visual do WhatsApp Web) ---------- */
.nav .badge.wa-count { background: #25d366; color: #fff; }
.content.wa-mode { padding: 0; display: flex; height: 100vh; overflow: hidden; }
:root {
  --wa-green: #00a884; --wa-badge: #25d366; --wa-text: #111b21; --wa-sub: #667781; --wa-icon: #54656f;
  --wa-panel: #f0f2f5; --wa-line: #e9edef; --wa-hover: #f5f6f6; --wa-out: #d9fdd3; --wa-in: #ffffff; --wa-chat: #efeae2; --wa-blue: #53bdeb;
}
.wa {
  display: grid; grid-template-columns: minmax(300px, 30%) 1fr; flex: 1; min-width: 0; height: 100%; background: #fff; color: var(--wa-text);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
}
.wa-side { display: flex; flex-direction: column; border-right: 1px solid var(--wa-line); min-width: 0; min-height: 0; background: #fff; }
.wa-head { display: flex; align-items: center; gap: 12px; height: 59px; padding: 10px 16px; background: var(--wa-panel); flex: none; }
.wa-head .grow { flex: 1; }
.wa-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; }
.wa-ibtn { background: none; border: 0; width: 40px; height: 40px; border-radius: 50%; color: var(--wa-icon); display: grid; place-items: center; cursor: pointer; flex: none; }
.wa-ibtn:hover { background: rgba(11, 20, 26, .08); }
.wa-search { display: flex; align-items: center; gap: 8px; margin: 7px 12px; padding: 0 12px; background: var(--wa-panel); border-radius: 8px; height: 35px; color: var(--wa-icon); }
.wa-search input { border: 0; background: transparent; outline: 0; flex: 1; font-size: 15px; padding: 0; height: 100%; color: var(--wa-text); box-shadow: none; }
.wa-search input::placeholder { color: var(--wa-sub); }
.wa-filters { display: flex; gap: 8px; padding: 2px 12px 8px; flex: none; }
.wa-filters button { white-space: nowrap; border: 0; background: var(--wa-panel); color: var(--wa-sub); border-radius: 99px; padding: 5px 12px; font-size: 14px; cursor: pointer; }
.wa-filters button.on { background: #e7fce3; color: #008069; }
.wa-list { overflow-y: auto; flex: 1; min-height: 0; }
.wa-item { display: flex; align-items: center; gap: 13px; padding: 0 0 0 13px; cursor: pointer; height: 72px; }
.wa-item:hover { background: var(--wa-hover); }
.wa-item.on { background: var(--wa-panel); }
.wa-item .wa-avatar { width: 49px; height: 49px; }
.wa-item-body { flex: 1; min-width: 0; border-bottom: 1px solid var(--wa-line); height: 100%; display: flex; flex-direction: column; justify-content: center; padding-right: 15px; }
.wa-item-top, .wa-item-bot { display: flex; align-items: center; gap: 6px; }
.wa-item-bot { margin-top: 2px; min-height: 20px; }
.wa-name { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--wa-text); }
.wa-time { font-size: 12px; color: var(--wa-sub); flex: none; }
.wa-item.unread .wa-time { color: var(--wa-badge); }
.wa-prev { flex: 1; min-width: 0; font-size: 14px; color: var(--wa-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.wa-item.unread .wa-prev { color: var(--wa-text); }
.wa-unread { background: var(--wa-badge); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; font-weight: 600; display: grid; place-items: center; flex: none; }
.wa-none { padding: 40px 24px; text-align: center; color: var(--wa-sub); font-size: 14px; }

.wa-main { min-width: 0; min-height: 0; display: flex; background: var(--wa-panel); }
.wa-empty { margin: auto; text-align: center; max-width: 460px; padding: 28px; color: var(--wa-sub); }
.wa-empty-art { font-size: 72px; filter: grayscale(.2); opacity: .8; }
.wa-empty h1 { font-size: 30px; font-weight: 300; color: #41525d; margin: 22px 0 14px; }
.wa-empty p { font-size: 14px; line-height: 20px; }
.wa-e2e { margin-top: 40px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.wa-chat { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.wa-chat-head { border-left: 1px solid var(--wa-line); }
.wa-chat-title { flex: 1; min-width: 0; }
.wa-chat-title .wa-name { font-size: 16px; display: block; }
.wa-sub { font-size: 13px; color: var(--wa-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-back { display: none; }

.wa-bg {
  background-color: var(--wa-chat);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23d6cfc4' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round' opacity='.75'%3E%3Ccircle cx='18' cy='20' r='7'/%3E%3Cpath d='M58 12l6 10H52z'/%3E%3Cpath d='M92 16c4-6 12 0 6 6l-6 6-6-6c-6-6 2-12 6-6z'/%3E%3Crect x='12' y='60' width='14' height='10' rx='2'/%3E%3Cpath d='M12 62l7 5 7-5'/%3E%3Cpath d='M52 62a8 8 0 1 1 3 6l-5 2 2-5'/%3E%3Cpath d='M90 58v14M83 65h14'/%3E%3Cpath d='M20 100l4 8 4-8 4 8'/%3E%3Ccircle cx='60' cy='104' r='3'/%3E%3Cpath d='M88 98h14v10H88zM92 98v-3h6v3'/%3E%3C/g%3E%3C/svg%3E");
}
.wa-msgs { flex: 1; overflow-y: auto; padding: 12px 7% 8px; min-height: 0; }
.wa-day { display: flex; justify-content: center; margin: 10px 0; }
.wa-day span { background: #fff; color: #54656f; font-size: 12.5px; padding: 5px 12px; border-radius: 7.5px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.wa-day .wa-note { background: #ffeecd; color: #54656f; max-width: 520px; text-align: center; display: inline-flex; gap: 6px; align-items: center; }
.wa-row { display: flex; margin-bottom: 2px; }
.wa-row.tail { margin-top: 10px; }
.wa-row.out { justify-content: flex-end; }
.wa-bubble { position: relative; max-width: 65%; padding: 6px 7px 8px 9px; border-radius: 7.5px; font-size: 14.2px; line-height: 19px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); word-wrap: break-word; overflow-wrap: anywhere; }
.wa-row.in .wa-bubble { background: var(--wa-in); }
.wa-row.out .wa-bubble { background: var(--wa-out); }
.wa-row.in.tail .wa-bubble { border-top-left-radius: 0; }
.wa-row.out.tail .wa-bubble { border-top-right-radius: 0; }
.wa-row.tail .wa-bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.wa-row.in.tail .wa-bubble::before { left: -8px; background: var(--wa-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.wa-row.out.tail .wa-bubble::before { right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.wa-author { font-size: 12.8px; font-weight: 600; color: #1fa855; margin-bottom: 2px; }
.wa-text code { font-family: Consolas, monospace; font-size: 13px; }
.wa-text a { color: #027eb5; }
.wa-meta { float: right; margin: 6px 0 -6px 10px; font-size: 11px; color: var(--wa-sub); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; position: relative; top: 2px; }
.wa-tick { display: inline-flex; color: #8696a0; }
.wa-tick.read { color: var(--wa-blue); }
.wa-tick.failed { color: #ea0038; }
.wa-fail { font-size: 12px; color: #ea0038; background: #fff; border-radius: 7px; padding: 3px 8px; margin: 2px 0 6px; max-width: 65%; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }

.wa-compose { background: var(--wa-panel); flex: none; position: relative; }
.wa-bar { display: flex; align-items: flex-end; gap: 4px; padding: 5px 16px; min-height: 62px; }
.wa-bar .wa-ibtn { margin-bottom: 6px; }
.wa-input { flex: 1; background: #fff; border-radius: 8px; padding: 9px 12px; margin: 5px 4px; }
.wa-input textarea { border: 0; outline: 0; resize: none; width: 100%; font-size: 15px; line-height: 20px; padding: 0; max-height: 132px; background: transparent; box-shadow: none; min-height: 0; display: block; color: var(--wa-text); font-family: inherit; }
.wa-input textarea::placeholder { color: var(--wa-sub); }
.wa-send { color: var(--wa-icon); }
.wa-emojis { position: absolute; bottom: 100%; left: 12px; background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(11, 20, 26, .2); padding: 8px; display: grid; grid-template-columns: repeat(10, 34px); gap: 2px; z-index: 5; }
.wa-emojis button { border: 0; background: none; font-size: 22px; width: 34px; height: 34px; border-radius: 6px; cursor: pointer; }
.wa-emojis button:hover { background: var(--wa-panel); }
.wa-closed { padding: 14px 24px; font-size: 14px; color: #54656f; text-align: center; line-height: 20px; }
.wa-closed a { color: #008069; }
.wa-warn { background: #fff8e1; color: #6b5300; font-size: 13px; padding: 6px 16px; text-align: center; }
.wa-btn { display: inline-flex; align-items: center; gap: 6px; margin: 8px auto 0; background: var(--wa-green); color: #fff; border: 0; border-radius: 99px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.wa-btn:hover { background: #008f6f; }

.wa-tpl { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; width: 100%; }
.wa-tpl:hover { border-color: #00a884; background: #f7fdfb; }
.wa-tpl-txt { margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-tpl-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; align-items: start; }
.wa-tpl-prev { border-radius: 10px; padding: 16px 20px; min-height: 160px; }
.wa-tpl-prev .wa-bubble { max-width: 100%; }
.wa-tpl-btns { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; margin-top: 2px; }
.wa-tpl-btns span { background: #fff; color: #027eb5; border-radius: 7.5px; padding: 8px; text-align: center; font-size: 14px; min-width: 60%; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }

@media (max-width: 900px) {
  .content.wa-mode { height: calc(100vh - 96px); }
  .wa { grid-template-columns: 1fr; }
  .wa .wa-main { display: none; }
  .wa.chat-open .wa-side { display: none; }
  .wa.chat-open .wa-main { display: flex; }
  .wa-back { display: grid; }
  .wa-msgs { padding: 10px 12px; }
  .wa-bubble { max-width: 85%; }
  .wa-tpl-edit { grid-template-columns: 1fr; }
  .wa-emojis { grid-template-columns: repeat(8, 34px); }
}
