/* =========================================================
   Disparo WhatsApp — tema
   ========================================================= */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e8ee;
  --border-strong: #d3d9e2;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #059669;
  --primary-600: #047857;
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --accent: #25d366;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --warning: #b45309;
  --warning-50: #fffbeb;
  --info: #2563eb;
  --info-50: #eff6ff;
  --sidebar: #0b1f19;
  --sidebar-2: #10291f;
  --sidebar-text: #a7c4b8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --ring: 0 0 0 4px rgba(5, 150, 105, .15);
  --sidebar-w: 248px;
  font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
[hidden] { display: none !important; }
h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
h3 { margin: 0 0 10px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
h4 { margin: 4px 0 8px; font-size: 14px; }
code { background: #eef2f6; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); font-weight: normal; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0 10px; }

/* permissões por perfil */
body:not(.is-admin) [data-admin] { display: none !important; }
body.is-admin .user-only { display: none !important; }
body:not(.can-templates) [data-tpl-manager] { display: none !important; }

/* =========================================================
   Estrutura: menu lateral + conteúdo
   ========================================================= */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0d2a20 100%);
  color: var(--sidebar-text); padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; color: #fff; }
.brand b { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand small { display: block; font-size: 11.5px; color: var(--sidebar-text); }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .35);
}
.logo svg { width: 22px; height: 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f8f82; padding: 14px 12px 6px; }
.tab {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--sidebar-text); font: inherit; font-weight: 500;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .15s, color .15s;
}
.tab:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.tab.active { background: rgba(37, 211, 102, .14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.tab.active svg { color: var(--accent); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; margin-top: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #1e4a3a; color: #d1fae5; font-weight: 700; font-size: 13px;
}
.user-meta { min-width: 0; }
.user-meta #user-name { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--sidebar-text); font-size: 12px; }
.user-actions { display: flex; gap: 6px; }
.side-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 255, 255, .06); border: 0; color: var(--sidebar-text); font: inherit; font-size: 12.5px;
  padding: 8px; border-radius: 9px; cursor: pointer;
}
.side-btn svg { width: 15px; height: 15px; }
.side-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 32px; background: rgba(243, 245, 248, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.page-title { font-weight: 600; color: var(--text-2); }
.account { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.menu-toggle { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px; cursor: pointer; color: var(--text); }
.backdrop { display: none; }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 64px; }

/* =========================================================
   Blocos
   ========================================================= */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar.small { margin-bottom: 12px; }
.toolbar.small h3 { margin: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.top-gap { margin-top: 18px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.empty {
  text-align: center; color: var(--muted); padding: 56px 20px; background: var(--surface);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
}
.alert { background: var(--danger-50); color: #991b1b; border: 1px solid #fecaca; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin: 10px 0; }

/* =========================================================
   Formulários
   ========================================================= */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.stack-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.stack-field > span { font-weight: 600; font-size: 13px; color: var(--text-2); }
.stack-field .hint { margin: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; margin-top: 10px; }
.inline-field { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
input, select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, select:hover, textarea:hover { border-color: #b8c2cf; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; padding: 0; box-shadow: none; }
input[type="file"] { padding: 8px; background: var(--surface-2); }
textarea { resize: vertical; width: 100%; line-height: 1.5; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
legend { font-weight: 650; padding: 0 6px; color: var(--text-2); }

.btn {
  font: inherit; font-weight: 600; font-size: 13.5px; border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: #b8c2cf; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(5, 150, 105, .3), 0 4px 12px rgba(5, 150, 105, .2); }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn.danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(15, 23, 42, .05); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; padding: 12px 16px; font-size: 14.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.linklike { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* =========================================================
   Tabelas
   ========================================================= */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover td { background: #f6fbf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.err { color: #b91c1c; font-size: 12.5px; max-width: 420px; cursor: help; }
.err-hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
.failure-list { display: grid; gap: 8px; }
.failure-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); cursor: help; }
.failure-item .hint { margin: 2px 0 0; }
.failure-item.clickable-item { cursor: pointer; transition: border-color .15s, background .15s; }
.failure-item.clickable-item:hover { border-color: #9fb3c4; background: #fff; }
.failure-item.selected { border-color: var(--primary); background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.failure-count { font-size: 18px; font-weight: 700; color: #b91c1c; font-variant-numeric: tabular-nums; }
td.check, th.check { width: 40px; }
td.fields { color: var(--muted); font-size: 12.5px; max-width: 280px; }
td.detail { font-size: 12.5px; color: var(--muted); max-width: 420px; word-break: break-word; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; }
#msg-search, #audit-search, #template-search, #optout-search { min-width: 260px; }

/* =========================================================
   Selos, progresso e indicadores
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.b-running, .b-sending, .b-pending, .b-scheduled { background: var(--info-50); color: #1d4ed8; }
.b-finished, .b-approved, .b-delivered, .b-read, .b-green { background: var(--primary-50); color: #047857; }
.b-sent { background: #f0fdfa; color: #0f766e; }
.b-paused, .b-yellow, .b-in_appeal { background: var(--warning-50); color: var(--warning); }
.b-failed, .b-rejected, .b-cancelled, .b-disabled, .b-red { background: var(--danger-50); color: #b91c1c; }
.b-skipped, .b-draft { background: #f1f5f9; color: #475569; }

.progress { display: inline-block; width: 120px; height: 8px; background: #e8edf2; border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.progress.big { width: 100%; height: 10px; margin: 16px 0 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .p { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-left: 4px; }
.stat.highlight { background: linear-gradient(135deg, #064e3b, #047857); border-color: transparent; color: #fff; grid-column: span 2; }
.stat.highlight .l, .stat.highlight .p { color: #a7f3d0; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat.highlight .sub { color: #d1fae5; }

.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.detail-head h2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.detail-head .muted { margin-top: 6px; line-height: 1.7; }
.cost-cell { font-weight: 600; font-variant-numeric: tabular-nums; }

/* =========================================================
   Campanha: mapeamento e agendamento
   ========================================================= */
.slot-row { display: grid; grid-template-columns: minmax(160px, 220px) minmax(160px, 1fr) minmax(160px, 1fr); gap: 10px; align-items: center; margin-bottom: 10px; }
.slot-label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.audience-count { font-weight: 600; color: var(--primary-600); }
.audience-count.warn { color: var(--danger); }
.when { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.when .check { margin: 0; }
.when input[type="datetime-local"] { margin-left: 26px; }

/* =========================================================
   Templates e pré-visualização WhatsApp
   ========================================================= */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.tpl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.tpl-card:hover { box-shadow: 0 8px 28px rgba(15, 23, 42, .1); transform: translateY(-1px); }
.tpl-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.tpl-card-head b { word-break: break-all; }
.tpl-card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; }
.tpl-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
.tpl-side { position: sticky; top: 80px; align-self: start; }
.btn-row { display: grid; grid-template-columns: 110px 1fr 1fr 1fr auto; gap: 6px; align-items: center; }
.btn-row[data-type="QUICK_REPLY"] { grid-template-columns: 110px 1fr auto; }
.btn-row[data-type="PHONE_NUMBER"] { grid-template-columns: 110px 1fr 1fr auto; }
.btn-type { font-size: 12px; color: var(--muted); font-weight: 600; }
#body-examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
#body-examples label { margin: 0; }

.wa-preview {
  background-color: #efeae2; border-radius: var(--radius); padding: 18px; min-height: 130px;
  background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px); background-size: 14px 14px;
}
.wa-preview.small { padding: 12px; min-height: 0; max-height: 330px; overflow: auto; }
.wa-bubble { background: #fff; border-radius: 0 10px 10px 10px; max-width: 330px; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); overflow: hidden; }
.wa-inner { padding: 8px 10px 6px; }
.wa-head { font-weight: 700; margin-bottom: 4px; }
.wa-media { background: #d6dde3; color: #475569; text-align: center; padding: 30px 8px; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.wa-media small { display: block; font-weight: normal; word-break: break-all; margin-top: 4px; letter-spacing: 0; }
.wa-media-img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.wa-body { word-wrap: break-word; line-height: 1.45; color: #111b21; }
.wa-footer { color: #8696a0; font-size: 12px; margin-top: 6px; }
.wa-time { text-align: right; color: #8696a0; font-size: 11px; }
.wa-buttons { border-top: 1px solid #eef0f2; }
.wa-btn { text-align: center; color: #0a7cff; padding: 9px; border-top: 1px solid #eef0f2; font-size: 13.5px; font-weight: 500; }
.wa-btn:first-child { border-top: 0; }
.var { background: #d9fdd3; border-radius: 4px; padding: 0 3px; }

/* =========================================================
   Contatos e tags
   ========================================================= */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  display: inline-flex; flex-direction: row; align-items: center; gap: 7px; padding: 6px 12px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: #fff; cursor: pointer;
  font-size: 13px; font-weight: 500; margin: 0; user-select: none; transition: border-color .15s, background .15s;
}
.chip input { margin: 0; }
.chip:hover { border-color: #9fb3c4; }
.chip:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.chip .count { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; margin: 1px 3px 1px 0; white-space: nowrap; }
.tag-gray { background: #f1f5f9; color: #475569; }
.tag-blue { background: #eff6ff; color: #1d4ed8; }
.tag-green { background: #ecfdf5; color: #047857; }
.tag-yellow { background: #fefce8; color: #a16207; }
.tag-orange { background: #fff7ed; color: #c2410c; }
.tag-red { background: #fef2f2; color: #b91c1c; }
.tag-purple { background: #f5f3ff; color: #6d28d9; }
.tag-teal { background: #f0fdfa; color: #0f766e; }
.filters { margin-bottom: 14px; }
.filters input[type="search"] { min-width: 280px; }
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--primary-50);
  border: 1px solid #a7f3d0; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px;
}
.bulk-bar #bulk-count { font-weight: 700; color: var(--primary-600); margin-right: 6px; }
.select-all-hint { background: var(--warning-50); border: 1px solid #fde68a; padding: 9px 14px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 13px; }
#ninth-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ok-text { color: var(--primary-600); }

/* =========================================================
   Segurança
   ========================================================= */
.checks { display: grid; gap: 10px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.check-item .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; }
.check-item .dot.ok { background: var(--primary); }
.check-item .dot.bad { background: #d97706; }
.check-item .hint { margin: 2px 0 0; }
.switch { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-weight: 600; cursor: pointer; }
.qr { width: 200px; height: 200px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.qr svg { width: 100%; height: 100%; stroke: none; fill: initial; }

/* =========================================================
   Janelas e avisos
   ========================================================= */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(580px, 94vw); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); }
.dlg-body { padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.dlg-body > h3 { font-size: 18px; margin-bottom: 12px; }
.dlg-body > label { margin-bottom: 4px; }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.spacer { flex: 1; }
.field-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.tag-row { display: grid; grid-template-columns: 1fr 130px 60px auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 12px; max-width: min(640px, 92vw);
  box-shadow: var(--shadow-lg); font-weight: 500; animation: toast-in .2s ease-out;
}
#toast.err { background: #b91c1c; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* =========================================================
   Login
   ========================================================= */
.login-page { min-height: 100vh; background: var(--bg); }
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero {
  position: relative; overflow: hidden; color: #e7f7f0; padding: 48px 56px; display: flex; flex-direction: column;
  background:
    radial-gradient(800px 400px at 110% 0%, rgba(37, 211, 102, .25), transparent 60%),
    radial-gradient(600px 400px at -10% 110%, rgba(16, 185, 129, .25), transparent 60%),
    linear-gradient(160deg, #0b1f19 0%, #0f3a2c 100%);
}
.login-hero .brand { padding: 0; }
.login-hero h1 { font-size: 38px; line-height: 1.15; letter-spacing: -.03em; margin: auto 0 14px; max-width: 520px; color: #fff; }
.login-hero p { color: #a7c4b8; font-size: 16px; max-width: 480px; margin: 0 0 28px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 10px; color: #d1fae5; }
.hero-points li { display: flex; align-items: center; gap: 10px; }
.hero-points svg { color: var(--accent); }
.hero-chat { position: absolute; right: 48px; top: 110px; display: grid; gap: 10px; width: 260px; opacity: .95; }
.hero-chat .msg { background: #fff; color: #111b21; border-radius: 0 12px 12px 12px; padding: 10px 12px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.hero-chat .msg.out { background: #d9fdd3; border-radius: 12px 0 12px 12px; justify-self: end; width: 80%; }
.hero-chat .msg small { display: block; text-align: right; color: #667781; font-size: 11px; margin-top: 4px; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }
.login-card label { margin-bottom: 16px; }
.password-field { position: relative; display: flex; }
.password-field input { flex: 1; padding-right: 44px; }
.password-field button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; }
.password-field button:hover { color: var(--text); background: var(--surface-2); }
.login-foot { color: var(--muted); font-size: 12.5px; margin-top: 28px; display: flex; align-items: center; gap: 6px; }
.login-foot svg { width: 14px; height: 14px; color: var(--primary); }
.code-input { text-align: center; font-size: 24px; letter-spacing: .4em; font-weight: 700; padding: 12px; }

/* =========================================================
   Dashboard e gráficos
   ========================================================= */
.chart { position: relative; min-height: 230px; --series-1: #059669; --series-2: #2a78d6; --grid: #e8ecf1; --axis: #cbd3dc; }
.chart svg { width: 100%; height: auto; display: block; stroke: none; fill: none; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .peak { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
.chart .bar { transition: opacity .12s; }
.chart.hovering .bar { opacity: .35; }
.chart.hovering .bar.on { opacity: 1; }
.chart-empty { display: grid; place-items: center; min-height: 200px; color: var(--muted); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; background: #0f172a; color: #fff; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; box-shadow: var(--shadow-lg); min-width: 170px; line-height: 1.6;
}
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip .k { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .k span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.table-toggle summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.nav-badge { margin-left: auto; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.meter { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.meter-track { flex: 1; height: 8px; border-radius: 99px; background: #d1fae5; overflow: hidden; }
.meter-track > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.meter.warn .meter-track { background: #fef3c7; } .meter.warn .meter-track > span { background: #d97706; }
.meter.crit .meter-track { background: #fee2e2; } .meter.crit .meter-track > span { background: #dc2626; }
.meter small { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.alerts-card h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.alert-item:first-of-type { border-top: 0; }
.alert-icon { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.alert-icon.critical { background: #dc2626; } .alert-icon.warning { background: #d97706; } .alert-icon.info { background: #2563eb; }
.alert-item .when { color: var(--muted); font-size: 12px; }

/* =========================================================
   Responsivo
   ========================================================= */
@media (max-width: 1100px) {
  .hero-chat { display: none; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 30; }
  .shell { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .appbar { padding: 10px 16px; }
  main { padding: 20px 16px 48px; }
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-side { position: static; }
  .slot-row, .btn-row, .btn-row[data-type], .tag-row, .field-row { grid-template-columns: 1fr; }
  .filters input[type="search"] { min-width: 0; width: 100%; }
  #msg-search, #audit-search, #template-search, #optout-search { min-width: 0; width: 100%; }
  .table-wrap td { white-space: nowrap; }
  .page-title { display: none; }
  .stat.highlight { grid-column: 1 / -1; }
  .failure-item { grid-template-columns: 44px 1fr; }
  .failure-item .badge { grid-column: 2; justify-self: start; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px; }
  .login-hero h1 { font-size: 28px; margin-top: 28px; }
  .hero-points { margin-bottom: 0; }
}
