/* Heavy Media — identidade: preto profundo, magenta Heavy, branco */
:root {
  --brand: #E8336B;
  --brand-strong: #FF4A80;
  --brand-soft: rgba(232, 51, 107, 0.14);
  --bg: #0B0B0E;
  --surface: #16161C;
  --surface-2: #1D1D25;
  --surface-3: #26262F;
  --border: #2A2A34;
  --border-strong: #3A3A46;
  --text: #F4F4F6;
  --text-2: #B4B4C0;
  --text-3: #7C7C8A;
  --ok: #2FBF71;
  --ok-soft: rgba(47, 191, 113, 0.14);
  --warn: #F29A2E;
  --warn-soft: rgba(242, 154, 46, 0.14);
  --crit: #F0443A;
  --crit-soft: rgba(240, 68, 58, 0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-head: 'Archivo', system-ui, sans-serif;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.eyebrow {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand); font-weight: 600;
}
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.sidebar {
  background: #0F0F13; border-right: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand img { width: 30px; height: auto; }
.brand .word { font-family: var(--font-head); font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.brand .word span { font-weight: 600; }
.brand .sub { font-size: 10px; color: var(--text-3); letter-spacing: 0.12em; text-transform: uppercase; margin-top: -2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--text); }
.nav a.active svg { color: var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.nav-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 4px; }
.sidebar .me {
  margin-top: auto; padding: 12px; border-radius: var(--radius-sm); background: var(--surface);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; font-family: var(--font-head);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11px; color: var(--text-3); }

.main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar { display: none; }

/* ---------- components ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: #ff8a84; }
.btn.danger:hover { background: var(--crit-soft); border-color: var(--crit); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-family: var(--font-head); font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .foot { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi.hero { background: linear-gradient(135deg, #2a0f1a 0%, var(--surface) 70%); border-color: rgba(232, 51, 107, 0.35); }
.kpi.hero .value { color: #fff; }
.cols-2 { grid-template-columns: 2fr 1fr; }
.cols-2e { grid-template-columns: 1fr 1fr; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.brand { background: var(--brand-soft); color: #ff8fb0; }
.badge.type { letter-spacing: 0.06em; font-size: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.status .dot { width: 9px; height: 9px; }
.status.ok { background: var(--ok-soft); color: #6fe0a2; } .status.ok .dot { background: var(--ok); }
.status.atencao { background: var(--warn-soft); color: #ffbf73; } .status.atencao .dot { background: var(--warn); }
.status.critico { background: var(--crit-soft); color: #ff8a84; } .status.critico .dot { background: var(--crit); }
.status.sem { background: var(--surface-3); color: var(--text-3); } .status.sem .dot { background: var(--text-3); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab {
  padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent;
  margin-bottom: -1px; cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: none; border-top: 0; border-left: 0; border-right: 0; font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.tab .count { font-size: 11px; background: var(--surface-3); padding: 1px 7px; border-radius: 999px; color: var(--text-2); }

.input, select.input, textarea.input {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { resize: vertical; min-height: 78px; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--text-3); }
.field .hint b { color: var(--text-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.prefix { position: relative; }
.prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.prefix .input { padding-left: 34px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--text-3); }
.search .input { padding-left: 34px; min-width: 240px; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button {
  background: none; border: 0; color: var(--text-2); padding: 7px 12px; border-radius: 7px; font-weight: 600; cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); }
.seg.status-pick button.on.ok { background: var(--ok-soft); color: #6fe0a2; }
.seg.status-pick button.on.atencao { background: var(--warn-soft); color: #ffbf73; }
.seg.status-pick button.on.critico { background: var(--crit-soft); color: #ff8a84; }

/* ---------- tables / lists ---------- */
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.list-item:hover .title { color: var(--brand-strong); }
.alert-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.alert-ico svg { width: 16px; height: 16px; }
.alert-ico.critico { background: var(--crit-soft); color: var(--crit); }
.alert-ico.atencao { background: var(--warn-soft); color: var(--warn); }

/* ---------- clientes ---------- */
.client-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.client-card { display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: border 0.15s, transform 0.15s; }
.client-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.client-card.inactive { opacity: 0.55; }
.client-card .top { display: flex; align-items: flex-start; gap: 12px; }
.client-logo {
  width: 42px; height: 42px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: 16px; color: var(--brand); flex: none;
}
.client-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.client-card .stats div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.client-card .stats b { display: block; font-family: var(--font-head); font-size: 15px; }
.client-card .stats span { font-size: 11px; color: var(--text-3); }
.health { display: flex; height: 6px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--bg); }
.health i { display: block; height: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- campanhas ---------- */
.account { margin-bottom: 26px; }
.account-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.account-head h3 { display: flex; align-items: center; gap: 8px; }
.account-head .spacer { flex: 1; }
.camp-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.camp { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.camp.paused { opacity: 0.6; }
.camp .bar { height: 3px; }
.camp .bar.ok { background: var(--ok); } .camp .bar.atencao { background: var(--warn); } .camp .bar.critico { background: var(--crit); } .camp .bar.sem { background: var(--border-strong); }
.camp .body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.camp .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.camp .name { font-weight: 700; font-size: 15px; font-family: var(--font-head); }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border-radius: 10px; overflow: hidden; }
.metric { background: var(--surface-2); padding: 9px 12px; }
.metric .l { font-size: 11px; color: var(--text-3); }
.metric .v { font-weight: 600; font-size: 14px; display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.delta { font-size: 11px; font-weight: 600; }
.delta.good { color: #6fe0a2; } .delta.bad { color: #ff8a84; } .delta.flat { color: var(--text-3); }
.pace { display: flex; flex-direction: column; gap: 6px; }
.pace .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.pace .track { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.pace .fill { height: 100%; background: var(--brand); border-radius: 999px; }
.pace .fill.over { background: var(--crit); }
.camp .notes { font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.camp .notes b { color: var(--text); font-weight: 600; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.camp .foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.camp .foot .who { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); flex: 1 1 100%; min-width: 0; margin-bottom: 2px; }
.camp .foot .spacer { flex: 1; }
.empty {
  text-align: center; padding: 42px 20px; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---------- timeline histórico ---------- */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-2); }
.tl-item .tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tl-item .tl-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 16px; font-size: 12px; margin-bottom: 10px; }
.tl-item .tl-metrics span { color: var(--text-3); display: block; font-size: 11px; }
.tl-item .tl-text { font-size: 13px; color: var(--text-2); display: grid; gap: 6px; }
.tl-item .tl-text b { color: var(--text); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 5, 8, 0.72); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto;
  animation: fade 0.15s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow); animation: pop 0.18s ease;
}
.modal.wide { max-width: 860px; }
.modal-head { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-body { padding: 18px 24px; }
.modal-foot { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.section-title { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin: 22px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-title:first-child { margin-top: 0; }
.prev-banner { background: var(--brand-soft); border: 1px solid rgba(232, 51, 107, 0.3); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px; color: #ffc0d2; margin-bottom: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface-3); border: 1px solid var(--border-strong); border-left: 3px solid var(--ok); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: pop 0.2s ease; max-width: 360px; }
.toast.error { border-left-color: var(--crit); }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  background: radial-gradient(circle at 30% 60%, rgba(232, 51, 107, 0.22), transparent 55%), #0F0F13;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
}
.auth-art .big-mark { position: absolute; right: -60px; bottom: -40px; width: 420px; opacity: 0.12; }
.auth-art h1 { font-size: 44px; line-height: 1.05; max-width: 480px; margin-top: 14px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-mobile-brand { display: none !important; }
.err { color: #ff8a84; font-size: 13px; min-height: 18px; }

.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-wrap .chart-box { width: 150px; height: 150px; flex: none; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.donut-legend .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.color-input { width: 44px; height: 38px; padding: 3px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); cursor: pointer; }
.toggle-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.toggle-line input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .cols-2, .cols-2e { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .page-head .actions { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 24px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-wrap .chart-box { margin: 0 auto; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .topbar {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: rgba(11, 11, 14, 0.92); backdrop-filter: blur(8px); z-index: 30;
  }
  .topbar img { width: 24px; }
  .main { padding: 20px 16px 60px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-mobile-brand { display: flex !important; margin-bottom: 18px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .camp-grid { grid-template-columns: 1fr; }
  .search .input { min-width: 0; }
  h1 { font-size: 22px; }
  .modal-backdrop { padding: 12px; }
}
.metrics .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Puxar do Reportei */
.pull-bar { border: 1px solid rgba(232, 51, 107, 0.35); background: linear-gradient(135deg, rgba(232, 51, 107, 0.10), transparent 70%); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 10px; }
.pull-title { display: flex; flex-direction: column; gap: 2px; }
.pull-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pull-controls label { display: flex; flex-direction: column; gap: 4px; }
.pull-controls .input { width: auto; padding: 8px 10px; }
@keyframes pulled { from { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); } }
.input.pulled { animation: pulled 1.8s ease; }
