:root {
    /* Paleta DfSend: preto, branco e o dourado da logo. (--green e o nome antigo do destaque: agora e dourado) */
    --bg: #0a0a0a;
    --panel: #121212;
    --panel-2: #181818;
    --panel-3: #202020;
    --border: #262626;
    --border-2: #343434;
    --green: #f5b814;
    --green-2: #d99a00;
    --green-soft: rgba(245, 184, 20, .12);
    --lime: #ffd650;
    --text: #f2f2f2;
    --muted: #9a9a9a;
    --muted-2: #666666;
    --danger: #ef4444;
    --yellow: #facc15;
    --blue: #60a5fa;
    --wa-bg: #0b141a;
    --wa-head: #1f2c34;
    --wa-bubble: #005c4b;
    --radius: 14px;
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body { background: var(--bg); }
body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green); cursor: pointer; text-decoration: none; }
svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.logo {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, var(--green), var(--lime));
    color: #1a1300; display: grid; place-items: center;
    box-shadow: 0 6px 18px rgba(245, 184, 20, .25);
}
.logo svg { width: 18px; height: 18px; }
.brand-lg { font-size: 24px; }
.brand-lg .logo { width: 40px; height: 40px; border-radius: 11px; }
.brand-lg .logo svg { width: 22px; height: 22px; }
/* Logo DfSend (imagem quadrada: mostra so a faixa do nome, recortada pelo CSS) */
.brand-logo { width: 150px; height: 46px; overflow: hidden; border-radius: 8px; margin: 0 0 6px -4px; flex-shrink: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; object-position: center 50%; transform: scale(1.04); mix-blend-mode: lighten; display: block; }
.brand-logo-lg { width: 260px; height: 80px; }
/* "Df" claro + "Send" verde */
.brand-name { font-weight: 800; letter-spacing: -.03em; }
.brand-name b { color: var(--green); font-weight: 800; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side {
    padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 28px;
    background:
        radial-gradient(600px 400px at 20% 20%, rgba(245, 184, 20, .18), transparent 60%),
        radial-gradient(500px 300px at 80% 90%, rgba(255, 214, 80, .10), transparent 60%),
        var(--panel);
    border-right: 1px solid var(--border);
}
.login-side h2 { font-size: 30px; line-height: 1.25; letter-spacing: -.02em; margin: 0; max-width: 460px; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: var(--muted); }
.login-points li { display: flex; align-items: center; gap: 10px; }
.login-points svg { color: var(--green); }
.login-card { align-self: center; justify-self: center; width: 100%; max-width: 380px; padding: 32px 24px; }
.login-card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
@media (max-width: 860px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-side { padding: 32px 24px; gap: 18px; border-right: none; border-bottom: 1px solid var(--border); }
    .login-side h2 { font-size: 22px; }
    .login-points { display: none; }
}

/* ---------- Layout ---------- */
.app { display: none; min-height: 100vh; }
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 30;
    background: var(--panel); border-right: 1px solid var(--border);
    padding: 20px 14px 14px; display: flex; flex-direction: column;
    transition: transform .2s ease;
}
.sidebar .brand { padding: 0 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-group {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted-2); padding: 16px 12px 6px;
}
.nav-group:first-child { padding-top: 0; }
.nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--muted); font-weight: 500; position: relative;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--green-soft); color: var(--green); }
.nav a.active::before {
    content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
    background: var(--green); border-radius: 0 3px 3px 0;
}
.soon {
    margin-left: auto; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
    background: var(--panel-3); color: var(--muted);
}

.user-card {
    margin-top: auto; display: flex; align-items: center; gap: 10px;
    padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--green-2), var(--green));
    color: #1a1300; display: grid; place-items: center; font-weight: 700;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.user-info { min-width: 0; flex: 1; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }

.icon-btn {
    background: transparent; border: none; color: var(--muted); cursor: pointer;
    width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }

.content { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 16px 32px; border-bottom: 1px solid var(--border);
    background: rgba(10, 13, 12, .85); backdrop-filter: blur(10px);
}
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.topbar-right { margin-left: auto; display: flex; gap: 10px; }
.menu-btn { display: none; }
.main { padding: 28px 32px 48px; }
.backdrop { display: none; }

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 25; }
    .content { margin-left: 0; }
    .menu-btn { display: grid; }
    .topbar { padding: 12px 16px; }
    .main { padding: 20px 16px 40px; }
}
@media (max-width: 520px) { .topbar-right .btn.small { padding: 9px 10px; font-size: 0; gap: 0; } .topbar-right .btn.small svg { width: 18px; height: 18px; } }

/* ---------- Cards ---------- */
.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.link { font-size: 13px; font-weight: 500; white-space: nowrap; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; align-items: center; gap: 14px;
}
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.stat-ico svg { width: 20px; height: 20px; }
.stat-ico.green { background: rgba(245, 184, 20,.12); color: var(--green); }
.stat-ico.yellow { background: rgba(250,204,21,.12); color: var(--yellow); }
.stat-ico.red { background: rgba(239,68,68,.12); color: #f87171; }
.stat-ico.blue { background: rgba(96,165,250,.12); color: var(--blue); }
.stat-num { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 12.5px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.dash-grid > *, .integ-grid > * { min-width: 0; }
.quick { display: grid; gap: 8px; }
.quick-item {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 11px;
    border: 1px solid var(--border); color: var(--text); background: var(--panel-2);
}
.quick-item:hover { border-color: var(--green); }
.quick-item > svg { color: var(--green); }
.quick-item b { display: block; font-weight: 600; font-size: 13.5px; }
.quick-item span { font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr; } }

/* ---------- Builder ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .builder { grid-template-columns: 1fr; } }

.step-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 4px; }
.step-num {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
    background: var(--green-soft); color: var(--green); border: 1px solid rgba(245, 184, 20,.25);
}
.step.accent { border-color: rgba(245, 184, 20,.35); background: linear-gradient(180deg, rgba(245, 184, 20,.06), transparent 60%), var(--panel); }

label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; }
.counter { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
input, select, textarea {
    width: 100%; background: var(--panel-2); border: 1px solid var(--border);
    color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px;
    font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 130px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
input:disabled { opacity: .5; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
    background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
    padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.active { background: var(--green-soft); border-color: rgba(245, 184, 20,.4); color: var(--green); }

/* ---------- Botoes ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--green); color: #1a1300; border: 1px solid transparent; font-weight: 600;
    padding: 10px 18px; border-radius: 10px; cursor: pointer; font-size: 14px; font-family: inherit;
    transition: background .15s, transform .05s;
}
.btn:hover { background: #2fd36b; }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.small svg { width: 16px; height: 16px; }
.btn-lg { padding: 13px 18px; font-size: 15px; margin-top: 14px; }
.btn.secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--border-2); background: var(--panel-3); }
.btn.ghost { background: transparent; color: var(--green); border: 1px dashed var(--border-2); width: 100%; }
.btn.ghost:hover { border-color: var(--green); background: var(--green-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-item { display: grid; grid-template-columns: 150px 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.btn-item .del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 16px; width: 34px; height: 34px; border-radius: 8px; }
.btn-item .del:hover { color: var(--danger); background: rgba(239,68,68,.1); }
@media (max-width: 640px) { .btn-item { grid-template-columns: 1fr 1fr auto; } .btn-item select { grid-column: 1 / -1; } }

/* ---------- Preview WhatsApp ---------- */
.preview-wrap { position: sticky; top: 96px; }
.preview-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.phone {
    position: relative; border-radius: 36px; padding: 10px; background: #050706;
    border: 1px solid var(--border-2); box-shadow: 0 30px 60px rgba(0,0,0,.45);
    max-width: 340px; margin: 0 auto;
}
.phone-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 90px; height: 22px; border-radius: 12px; background: #050706; z-index: 2; }
.wa-top {
    display: flex; align-items: center; gap: 10px; padding: 40px 14px 10px;
    background: var(--wa-head); border-radius: 28px 28px 0 0;
}
.wa-back { font-size: 22px; color: #aebac1; line-height: 1; }
.wa-top .nm { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.wa-top .st { font-size: 11.5px; color: #8696a0; }
.verified { width: 14px; height: 14px; border-radius: 50%; background: var(--green); color: #1a1300; display: inline-grid; place-items: center; }
.verified svg { width: 10px; height: 10px; }
.wa-chat {
    min-height: 420px; padding: 14px 12px 18px;
    background-color: var(--wa-bg);
    background-image:
        radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 22px 22px, 22px 22px;
    background-position: 0 0, 11px 11px;
}
.wa-day { width: fit-content; margin: 0 auto 12px; font-size: 11px; color: #8696a0; background: #182229; padding: 4px 10px; border-radius: 7px; }
.bubble {
    background: var(--wa-bubble); border-radius: 0 10px 10px 10px; padding: 8px 10px 6px;
    max-width: 88%; font-size: 13.5px; line-height: 1.45; word-break: break-word;
    position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.bubble::before {
    content: ""; position: absolute; top: 0; left: -7px;
    border-top: 8px solid var(--wa-bubble); border-left: 8px solid transparent;
}
.bubble .hdr { font-weight: 700; margin-bottom: 4px; white-space: pre-wrap; }
.bubble .hdr:empty { display: none; }
#pv-body { white-space: pre-wrap; }
.bubble .ftr { color: rgba(233,240,235,.6); font-size: 12px; margin-top: 4px; }
.bubble .ftr:empty { display: none; }
.bubble .time { text-align: right; font-size: 10.5px; color: rgba(233,240,235,.6); margin-top: 2px; }
.bubble img.media-ph { width: 100%; border-radius: 6px; margin-bottom: 6px; display: block; }
.wa-buttons { max-width: 88%; display: grid; gap: 2px; margin-top: 2px; }
.wa-btn {
    text-align: center; color: #53bdeb; padding: 9px; font-size: 13.5px; font-weight: 500;
    background: var(--wa-bubble); border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.wa-input { background: var(--wa-bg); padding: 0 10px 14px; border-radius: 0 0 28px 28px; }
.wa-input span { display: block; background: #1f2c34; color: #8696a0; border-radius: 20px; padding: 9px 14px; font-size: 13px; }

/* ---------- Lista / tabelas ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 16px; height: 16px; }
.search input { padding-left: 34px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.sync { display: flex; gap: 8px; margin-left: auto; }
.sync select { width: 200px; }
@media (max-width: 720px) { .search { max-width: none; } .sync { margin-left: 0; width: 100%; } .sync select { flex: 1; width: auto; min-width: 0; } }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover td { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }
td.name { font-weight: 500; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
td .inline-note { white-space: normal; max-width: 320px; }
.empty-row td { color: var(--muted); text-align: center; padding: 28px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.PENDING { background: rgba(250,204,21,.12); color: var(--yellow); }
.tag.APPROVED { background: rgba(34,197,94,.12); color: #4ade80; }
.tag.REJECTED, .tag.ERROR { background: rgba(239,68,68,.12); color: #f87171; }
.tag.PAUSED, .tag.DISABLED { background: var(--panel-3); color: var(--muted); }

.del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 16px; border-radius: 8px; padding: 4px 8px; }
.del:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ---------- Janela de confirmacao ---------- */
.modal-confirm { max-width: 420px; }
#confirm-modal { z-index: 65; }
.confirm-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(239,68,68,.12); color: #f87171; }
.confirm-ico svg { width: 18px; height: 18px; }
.confirm-text { margin: 10px 0 0; color: var(--muted); line-height: 1.55; white-space: pre-line; font-size: 13.5px; }
.confirm-text b { color: var(--text); }
.modal-actions .btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.modal-actions .btn.danger:hover { background: #dc2626; }

/* ---------- Popup de edicao (construtor dentro da janela) ---------- */
.modal.modal-editor { max-width: 1180px; height: calc(100vh - 32px); }
.modal-editor .modal-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.modal-editor .modal-body { padding: 18px 20px 4px; background: var(--bg); }
.modal-editor .modal-actions { border-top: 1px solid var(--border); align-items: center; }
.modal-editor .modal-actions .btn { flex: 0 0 auto; }
.modal-editor .step.accent { display: none; }            /* o envio e pelos botoes do rodape do popup */
.modal-editor .preview-wrap { top: 0; }
/* Na edicao, nome, categoria e idioma aparecem so para consulta (travados). */
.modal-editor #f-name, .modal-editor #f-category, .modal-editor #f-language { opacity: .6; cursor: not-allowed; }
.edit-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(250,204,21,.12); color: var(--yellow); flex-shrink: 0; }
.edit-names { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 760px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-note { margin-right: auto; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) { .edit-note { display: none; } .modal-editor .modal-actions .btn { flex: 1; } }

/* ---------- Apagar templates ---------- */
.btn.danger { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.35); }
.btn.danger:hover { background: rgba(239,68,68,.2); }
.col-check { width: 36px; }
th input[type="checkbox"], td input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }
tbody tr.checked td { background: var(--green-soft); }
.row-del { opacity: .6; }
tbody tr:hover .row-del { opacity: 1; }

/* ---------- Contas Infobip ---------- */
.tag.ACTIVE { background: rgba(34,197,94,.12); color: #4ade80; }
.tag.INACTIVE { background: var(--panel-3); color: var(--muted); }
.ib-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.ib-actions .icon-btn { width: 30px; height: 30px; }
.ib-actions .icon-btn svg { width: 15px; height: 15px; }
.ib-actions .icon-btn.danger:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ---------- Integracoes ---------- */
.integ-grid { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .integ-grid { grid-template-columns: 1fr; } }

/* ---------- Vazio ---------- */
.empty { text-align: center; padding: 56px 24px; }
.bc-connect-btn { margin: 18px auto 0; }
/* Transmissao */
.muted { color: var(--muted); }
.bc-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.bc-tab { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; margin-bottom: -1px; }
.bc-tab svg { width: 16px; height: 16px; }
.bc-tab:hover { color: var(--text); }
.bc-tab.active { color: var(--green); border-bottom-color: var(--green); }
.bc-cards { display: grid; gap: 12px; }
.bc-acc-card { padding: 16px 18px; }
.bc-acc-head { display: flex; align-items: center; gap: 12px; }
.bc-acc-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex-shrink: 0; }
.bc-acc-ico svg { width: 18px; height: 18px; }
.bc-acc-info { flex: 1; min-width: 0; }
.bc-acc-name { font-weight: 600; font-size: 15px; }
.bc-acc-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-acc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bc-acc-actions .btn { width: auto; }
.bc-nums { margin-top: 12px; display: grid; gap: 6px; }
.bc-num { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.bc-num summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; font-size: 13px; list-style: none; }
.bc-num summary::-webkit-details-marker { display: none; }
.bc-num-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-num-info { flex-shrink: 0; color: var(--muted); font-size: 12.5px; }
.bc-tpl-names { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; max-height: 180px; overflow-y: auto; }
.bc-back { width: auto; margin-bottom: 12px; }
.bc-source { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); font-size: 14px; }
.ibl-toolbar { display: flex; gap: 12px; align-items: center; }
.ibl-toolbar input#ibl-search { flex: 1; margin: 0; }
.ibl-all { margin: 0; white-space: nowrap; }
.ibl-list { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; margin-top: 8px; padding-right: 4px; }
.ibl-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 400; margin: 0; }
.ibl-item:hover { border-color: var(--border-2); }
.ibl-item input { width: auto; margin: 0; }
.ibl-item.off { opacity: .55; }
.ibl-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.ibl-item-main span { color: var(--muted); font-size: 12px; }
.bc-connect-more { margin-top: 12px; width: auto; }
.bc-num-head { margin-top: 14px; }
.bc-num-list { max-height: 260px; }
.bc-num-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 4px 0 10px; }
.bc-num-tabs:empty { display: none; }
.bc-num-tab { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.bc-num-tab:hover { border-color: var(--border-2); }
.bc-num-tab.active { border-color: rgba(245, 184, 20,.5); background: var(--green-soft); }
.bc-num-tab-n { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.bc-num-tab-t { font-size: 11.5px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-num-tab-t.ok { color: var(--green); }
#confirm-text { white-space: pre-line; }

/* Coluna WABA em Meus Templates: nome em cima, ID menor embaixo */
.waba-name { font-weight: 600; font-size: 13px; }
.waba-id.muted { font-size: 11.5px; color: var(--muted); }

/* Contas, funcionarios e clientes */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 6px; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font-weight: 400; margin: 0; cursor: pointer; font-size: 13px; }
.perm-item input { width: auto; margin: 0; }
.user-card-btn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.user-card-btn:hover .user-name { color: var(--green); }

/* Higienizacao */
.hy-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; padding: 28px 16px; border: 1.5px dashed var(--border-2); border-radius: 14px; cursor: pointer; text-align: center; color: var(--muted); font-weight: 400; }
.hy-drop svg { width: 28px; height: 28px; color: var(--green); }
.hy-drop b { color: var(--text); }
.hy-drop span { font-size: 12.5px; }
.hy-drop:hover, .hy-drop.over { border-color: var(--green); background: var(--green-soft); }
.hy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.hy-tool { display: flex; flex-direction: column; gap: 6px; }
.hy-tool h4 { margin: 0 0 4px; font-size: 14px; }
.hy-tool .btn { margin-top: auto; }
.hy-tool .bc-optin { margin: 2px 0; }
.hy-tool-accent { border-color: rgba(245, 184, 20,.35); }
.hy-small-ta { min-height: 80px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.hy-upload { margin-top: 16px; }
.hy-upload .step-num svg { width: 14px; height: 14px; }
.hy-export { display: flex; gap: 6px; }
.hy-export .btn { width: auto; }
.hy-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.hy-pager .btn { width: auto; }
.bc-tpl-checks { max-height: 280px; margin-top: 6px; }
.bc-var-tags { display: grid; gap: 6px; margin-top: 6px; }
.bc-var-tags:empty::before { content: "Marque os templates acima."; font-size: 12px; color: var(--muted); }
.bc-var-tag-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; }
.bc-var-tag-row select { margin: 0; }
.bc-vt-tag { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-vt-count { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.bc-vt-x { width: 22px; height: 22px; padding: 0; }
.bc-vt-x svg { width: 12px; height: 12px; }
#bc-tag-checks { max-height: 220px; }
#bc-var-tags { margin-top: 10px; }
.bc-var-tag-row .bc-vt-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-var-tag-row .bc-vt-count { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 70px; text-align: right; }
.bc-list-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.bc-list-tools .btn { width: auto; }
.bc-list-tools #bc-sel-info { margin-left: auto; }
.tag.bc-DRAFT { background: rgba(59,130,246,.14); color: #93c5fd; }
.tag.bc-QUEUED { background: rgba(168,85,247,.14); color: #d8b4fe; }
.bc-fill-all {padding: 12px; border: 1px dashed var(--border-2); border-radius: 10px; margin-bottom: 12px; }
.bc-fill-all label { margin-top: 0; }
.bc-tpl-head { margin-top: 8px; }
#bc-var-tabs { margin-top: 0; }
.bc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 170px; overflow-y: auto; padding: 2px; }
.bc-tag { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.bc-tag:hover { color: var(--text); border-color: var(--border-2); }
.bc-tag.active { background: var(--green-soft); border-color: rgba(245, 184, 20,.45); color: var(--green); }
.bc-tag-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px; }
.bc-tag-actions .btn { width: auto; }
#bc-tags-reload { width: auto; padding: 4px 8px; }
.tag.UNKNOWN { background: rgba(250,204,21,.12); color: var(--yellow); }
.bc-prog-actions .btn { width: auto; }
.bc-tpl-list { margin-top: 8px; height: auto; min-height: 150px; padding: 4px; }
.bc-tpl-list option { padding: 6px 8px; border-radius: 6px; }
.bc-var-list { display: grid; gap: 8px; }
.bc-var { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.bc-var input { flex: 1; min-width: 0; margin: 0; }
#bc-copy-all { width: auto; flex-shrink: 0; }
.bc-copy-vars-row { display: flex; justify-content: flex-end; }
.bc-copy-vars-row .btn { width: auto; margin-top: 10px; }
.bc-var-tag { flex-shrink: 0; min-width: 52px; text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 6px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); }
.bc-contacts { min-height: 160px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.bc-csv-btn { cursor: pointer; }
.bc-count { margin-top: 8px; font-size: 13px; color: var(--muted); }
.bc-count b { color: var(--text); }
.bad { color: #f87171; }
.bc-optin { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; font-size: 13px; color: var(--text); cursor: pointer; font-weight: 400; }
.bc-optin input { width: auto; margin: 2px 0 0; }
.bc-prog-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.bc-last-error { color: #fca5a5; }
.bc-pv-media img, .bc-pv-media video { width: 100%; border-radius: 6px; margin-bottom: 6px; display: block; background: #000; }
.bc-pv-ph { height: 120px; border-radius: 6px; margin-bottom: 6px; display: grid; place-items: center; background: rgba(255,255,255,.06); color: rgba(233,240,235,.6); font-size: 12px; }
.tag.bc-RUNNING { background: rgba(34,197,94,.12); color: #4ade80; }
.tag.bc-DONE { background: rgba(59,130,246,.14); color: #93c5fd; }
.tag.bc-PAUSED, .tag.bc-INTERRUPTED { background: rgba(250,204,21,.12); color: var(--yellow); }
.tag.bc-CANCELED { background: var(--panel-3); color: var(--muted); }
.empty-ico {width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.empty-ico svg { width: 26px; height: 26px; }
.empty .hint { max-width: 380px; margin: 6px auto 0; }

/* ---------- Janela (modal) ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
    display: grid; place-items: center; padding: 16px; animation: fade-in .15s ease;
}
.modal {
    width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
    background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0,0,0,.55);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 4px; }
.modal-title { display: flex; align-items: center; gap: 10px; }
.modal-title > svg { color: var(--green); }
.modal-title h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 0 20px 6px; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; padding: 16px 20px 20px; }
.modal-actions .btn { flex: 1; }
.summary { margin-top: 18px; border: 1px solid var(--border); background: var(--panel-2); border-radius: 12px; padding: 14px 16px; }
.summary-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.summary-title svg { color: var(--green); width: 16px; height: 16px; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; font-size: 13px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 500; word-break: break-all; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Barra de progresso ---------- */
.progress-box { margin-top: 16px; border: 1px solid rgba(245, 184, 20,.3); background: var(--panel-2); border-radius: 12px; padding: 14px 16px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; margin-bottom: 10px; }
.progress-head #p-label { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-pct { font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.progress-fill {
    height: 100%; width: 0; border-radius: 999px; transition: width .4s ease;
    background: linear-gradient(90deg, var(--green-2), var(--green), var(--lime));
    background-size: 200% 100%; animation: progress-shine 1.6s linear infinite;
}
.progress-box.done .progress-fill { animation: none; }
.progress-box.has-errors { border-color: rgba(239,68,68,.35); }
@keyframes progress-shine { from { background-position: 200% 0; } to { background-position: 0 0; } }
.progress-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-stats b { color: var(--text); font-weight: 600; }
.progress-stats span { display: inline-flex; align-items: center; gap: 4px; }
.progress-stats svg { width: 14px; height: 14px; }
.progress-stats .ok svg { color: var(--green); }
.progress-stats .bad svg { color: #f87171; }
.progress-stats .eta { margin-left: auto; }
.progress-errors { list-style: none; margin: 10px 0 0; padding: 0; max-height: 120px; overflow-y: auto; font-size: 12px; display: grid; gap: 6px; }
.progress-errors:empty { display: none; }
.progress-errors li { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); border-radius: 8px; padding: 6px 8px; color: #fca5a5; word-break: break-word; }
.progress-errors li b { color: #f87171; font-family: ui-monospace, Consolas, monospace; }

/* ---------- Galeria de midias ---------- */
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.input-row .btn { white-space: nowrap; }
.modal.modal-wide { max-width: 760px; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
    border: 1.5px dashed var(--border-2); border-radius: 14px; padding: 28px 16px; cursor: pointer; margin: 0;
    color: var(--muted); font-size: 12.5px; transition: border-color .15s, background .15s;
}
.dropzone b { color: var(--text); font-size: 14px; font-weight: 600; }
.dropzone:hover, .dropzone.over { border-color: var(--green); background: var(--green-soft); }
.dropzone.small { flex-direction: row; padding: 12px 16px; gap: 10px; }
.dropzone.small svg { color: var(--green); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.drop-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); margin-bottom: 4px; }
.drop-ico svg { width: 22px; height: 22px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 4px; }
.media-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 28px 8px; font-size: 13px; }
.media-item {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel-2);
    display: flex; flex-direction: column; text-align: left; font-family: inherit; color: var(--text); padding: 0;
}
button.media-item { cursor: pointer; }
button.media-item:hover { border-color: var(--green); }
.media-item.selected { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.media-grid { align-items: start; }
.media-thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #0b0f0d; display: grid; place-items: center; color: var(--muted); }
.media-thumb img, .media-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* Estrela de favorito */
.star-btn {
    position: absolute; top: 6px; right: 6px; z-index: 1; width: 32px; height: 32px; border-radius: 9px;
    display: grid; place-items: center; cursor: pointer; border: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.55); color: #e5e7eb; backdrop-filter: blur(4px);
}
.media-thumb .star-btn svg { width: 17px; height: 17px; fill: none; }
.star-btn:hover { color: var(--yellow); border-color: rgba(250,204,21,.5); }
.star-btn.on { color: var(--yellow); border-color: rgba(250,204,21,.6); background: rgba(40,32,0,.7); }
.media-thumb .star-btn.on svg { fill: currentColor; }
.fav-badge {
    position: absolute; top: 6px; left: 6px; z-index: 1; display: inline-flex; align-items: center; gap: 4px;
    font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 999px;
    background: rgba(250,204,21,.92); color: #2b2100;
}
.media-thumb .fav-badge svg { width: 11px; height: 11px; fill: currentColor; }
.media-item.is-fav { border-color: rgba(250,204,21,.45); }
.media-thumb svg { width: 34px; height: 34px; }
.media-meta { padding: 8px 10px; display: grid; gap: 2px; min-width: 0; }
.media-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-sub { font-size: 11px; color: var(--muted); }
.media-actions { display: flex; gap: 4px; padding: 0 6px 6px; }
.media-actions .icon-btn { width: 30px; height: 30px; }
.media-actions .icon-btn svg { width: 15px; height: 15px; }
.media-actions .icon-btn.danger:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.wa-media-doc { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.2); border-radius: 6px; padding: 10px; margin-bottom: 6px; font-size: 12.5px; }
.wa-media-doc svg { width: 22px; height: 22px; color: #d9e6df; }
.bubble video.media-ph { width: 100%; border-radius: 6px; margin-bottom: 6px; display: block; background: #000; }

/* ---------- Indicador de envio no topo ---------- */
.top-job {
    display: flex; align-items: center; gap: 10px; cursor: pointer; font-family: inherit;
    background: var(--panel-2); border: 1px solid rgba(245, 184, 20,.35); color: var(--text);
    border-radius: 10px; padding: 6px 12px; min-width: 0; animation: fade-in .2s ease;
}
.top-job:hover { border-color: var(--green); background: var(--panel-3); }
.tj-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; animation: tj-pulse 1.2s ease-in-out infinite; }
.top-job.done .tj-dot { animation: none; }
.top-job.has-errors { border-color: rgba(239,68,68,.45); }
.top-job.has-errors .tj-dot { background: #f87171; }
@keyframes tj-pulse { 50% { opacity: .3; } }
.tj-info { display: flex; flex-direction: column; gap: 5px; width: 170px; min-width: 0; text-align: left; }
.tj-label { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tj-track { display: block; height: 5px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.tj-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--green-2), var(--lime)); transition: width .4s ease; }
.tj-count { font-size: 13px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-job.has-errors .tj-count { color: #f87171; }
@media (max-width: 640px) { .tj-info { width: 70px; } .tj-label { display: none; } }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 24px; right: 24px; background: var(--panel-3);
    border: 1px solid var(--border-2); border-left: 4px solid var(--green); border-radius: 12px; padding: 14px 18px;
    max-width: 360px; display: none; z-index: 70; box-shadow: 0 12px 30px rgba(0,0,0,.4);
}
.toast.show { display: block; animation: toast-in .2s ease; }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 520px) { .toast { left: 16px; right: 16px; max-width: none; } }

.hidden { display: none !important; }
.inline-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
