:root {
  --bg: #0F1218;
  --surface: #171B24;
  --surface-2: #1E2330;
  --border: #2A2F3D;
  --text: #EDEFF4;
  --text-muted: #8B93A7;
  --accent: #F2B84B;
  --good: #35D08B;
  --warn: #F2B84B;
  --bad: #E85D5D;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--bg));
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; flex: 1; }
.mark-logo {
  height: 34px;
  width: auto;
  display: block;
}

.app-switch {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  margin-left: auto;
}
.app-switch a {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all .15s;
}
.app-switch a:hover { color: var(--text); }
.app-switch a.active { background: var(--accent); color: #1a1305; }
.topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--text); }
.metrics-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #F2B84B, #FDE08A, #C9922E);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }

/* ---------- Dropdown menu (⋮) ---------- */
.menu-dropdown { position: relative; }
.menu-trigger {
  font-size: 20px;
  line-height: 1;
  padding: 6px 14px;
  cursor: pointer;
  background: transparent;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 210px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  z-index: 50;
  overflow: hidden;
}
.menu-dropdown.open .menu-panel { display: block; }
.menu-panel a {
  display: block;
  padding: 11px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.menu-panel a:last-child { border-bottom: none; }
.menu-panel a:hover { background: var(--surface-2); }

/* ---------- Events feed ---------- */
.events-feed { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.event-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); font-size: 13px; }
.event-row .ev-tipo { font-weight: 600; min-width: 80px; padding: 3px 8px; border-radius: 6px; text-align: center; display: inline-block; }
.event-row .ev-tipo.ftd { background: rgba(53,208,139,.15); color: var(--good); }
.event-row .ev-tipo.dep { background: rgba(242,184,75,.15); color: var(--accent); }
.event-row .ev-tipo.wd { background: rgba(232,93,93,.15); color: var(--bad); }
.event-row .ev-tipo.reg { background: var(--surface-2); color: var(--text-muted); }
.event-row .ev-membro { flex: 1; min-width: 0; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-row .ev-cliente { color: var(--text-muted); opacity: .65; font-size: 12px; }
.event-row .ev-valor { font-family: var(--font-mono); }
.event-row .ev-quando { color: var(--text-muted); font-size: 12px; min-width: 70px; text-align: right; }
.event-row.new { animation: flashNew 1.5s ease-out; }
@keyframes flashNew { from { background: rgba(242,184,75,.18); } to { background: var(--surface); } }
.who { color: var(--text-muted); font-size: 14px; }

.btn-ghost {
  text-decoration: none;
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 7px;
  transition: border-color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--accent); background: var(--surface-2); }

/* ---------- Layout ---------- */
.wrap { max-width: 1800px; margin: 0 auto; padding: 28px 32px 80px; width: 100%; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.period-presets { display: flex; gap: 8px; }
.member-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.member-filter button, .member-filter a, .period-presets button, .btn-primary, .btn-small {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.member-filter button:hover, .member-filter a:hover, .period-presets button:hover { color: var(--text); }
.member-filter button.active, .member-filter a.active, .period-presets button.active { background: var(--accent); color: #1a1305; border-color: var(--accent); }

.period-custom { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.period-custom label, .grid-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Alterna Agência/Pessoal no Eficiência, ao lado do dropdown de Membro */
.category-toggle {
  display: flex; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; overflow: hidden;
}
.category-toggle button {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  border: none; background: none; color: var(--text-muted);
  padding: 9px 14px; cursor: pointer; transition: background-color .15s, color .15s;
}
.category-toggle button:first-child { border-right: 1px solid var(--border); }
.category-toggle button.active { background: var(--accent); color: #14161c; }

/* ---------- Dropdowns compactos de Período/Membro (estilo Meta Ads) ---------- */
.controls-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.dropdown-select { position: relative; }
.dropdown-trigger {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 8px; cursor: pointer; transition: border-color .15s;
}
.dropdown-trigger:hover { border-color: #3A404F; }
.dropdown-select.open .dropdown-trigger { border-color: var(--accent); }
.dropdown-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4); padding: 10px; min-width: 220px;
}
.dropdown-select.open .dropdown-panel { display: block; }
.dropdown-presets { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.dropdown-presets button, .dropdown-panel-list button,
.dropdown-presets a, .dropdown-panel-list a {
  display: block; width: 100%; text-align: left; font-family: var(--font-body);
  font-size: 13px; border: none; background: none; color: var(--text-muted);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  box-sizing: border-box;
}
.dropdown-presets button:hover, .dropdown-panel-list button:hover,
.dropdown-presets a:hover, .dropdown-panel-list a:hover { background: var(--surface-2); color: var(--text); }
.dropdown-presets button.active, .dropdown-panel-list button.active,
.dropdown-presets a.active, .dropdown-panel-list a.active { background: var(--accent); color: #1a1305; font-weight: 600; }
.dropdown-panel-list { max-height: 320px; overflow-y: auto; }
.dropdown-custom { display: flex; flex-direction: column; gap: 8px; }
.dropdown-custom label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-muted); }
.dropdown-custom input[type="date"] { width: 100%; }
input, select {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
}
input:focus, select:focus, button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-primary {
  background: var(--accent);
  color: #1a1305;
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-small { padding: 6px 10px; font-size: 12px; }
.btn-accent {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1305;
  border: none;
  cursor: pointer;
}
.btn-accent:hover { filter: brightness(1.08); }

/* ---------- Paginação ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.pagination .btn-small { text-decoration: none; }
.pagination .btn-small.active { background: var(--accent); color: #1a1305; font-weight: 600; }
.pagination .btn-small.disabled { opacity: .4; pointer-events: none; }

/* ---------- Summary bar ---------- */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.stat-chip .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-chip .value { font-family: var(--font-mono); font-size: 17px; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Cards (signature gauge) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}
.member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.gauge {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.gauge::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
}
.gauge-value {
  position: relative;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 19px;
  z-index: 1;
}
.member-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.member-sub { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* Quebra "desse total, quanto veio de cada sub-afiliado" na Eficiência */
.subaffiliate-card { align-items: stretch; text-align: left; gap: 6px; }
.subaffiliate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.subaffiliate-row:first-of-type { border-top: none; }
.subaffiliate-name { font-weight: 600; }
.subaffiliate-stats { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* Linha discreta "🔗 sub-afiliado linkado" embaixo do nome no card compacto
   (visão "Todos") — mesmo ícone/cor dourada do link de sincronização do
   Panorama (icon('link') com var(--accent)), só menor pra caber no card. */
.subaffiliate-link-line {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 10px;
  line-height: 1.3;
}
.subaffiliate-link-line svg { flex-shrink: 0; }

/* ---------- Layout de 2 colunas (só na Eficiência) ---------- */
.dashboard-columns { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.dashboard-left { flex: 0 0 360px; min-width: 0; }
.dashboard-right { flex: 1; min-width: 0; }
.dashboard-left .cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }

/* Versão compacta dos cartões, só na lista "Todos" da Eficiência —
   não mexe no .member-card padrão usado em Vendas/Meta Ads */
.member-card.compact {
  flex-direction: row;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  gap: 8px;
}
.member-card.compact .gauge { width: 42px; height: 42px; flex-shrink: 0; }
.member-card.compact .gauge::before { inset: 4px; }
.member-card.compact .gauge-value { font-size: 11px; }
.member-card.compact .member-name { font-size: 12px; line-height: 1.2; }
.member-card.compact .member-sub { font-size: 10px; }
.member-card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.dashboard-right .events-feed { max-height: 470px; overflow-y: auto; }
.dashboard-right .event-row { padding: 6px 10px; font-size: 11px; gap: 8px; }
.dashboard-right .event-row .ev-tipo { min-width: 0; padding: 0 6px; font-size: 10px; border-radius: 4px; }
.events-feed-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.events-feed-header .mute-toggle { margin-bottom: 0; }

@media (max-width: 900px) {
  .dashboard-columns { flex-direction: column; }
  .dashboard-left { flex: none; width: 100%; }
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill.good { background: rgba(53,208,139,.15); color: var(--good); }
.pill.warn { background: rgba(242,184,75,.15); color: var(--warn); }
.pill.bad { background: rgba(232,93,93,.15); color: var(--bad); }
.pill.none { background: var(--surface-2); color: var(--text-muted); }

.muted { color: var(--text-muted); }
.empty-state { padding: 40px; text-align: center; color: var(--text-muted); }

/* ---------- Member detail charts ---------- */
.member-detail { margin-bottom: 28px; }
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  height: 240px;
  display: flex;
  flex-direction: column;
}
.chart-card h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 12px;
}
.chart-card canvas { flex: 1; width: 100% !important; height: auto !important; }

/* ---------- Resumo mês a mês ---------- */
.monthly-table-wrap {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  overflow-x: auto;
}
.monthly-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.monthly-header h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 !important;
}
.monthly-controls { display: flex; align-items: center; gap: 10px; }
.segment-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.segment-toggle button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segment-toggle button.active { background: var(--accent); color: #1a1305; font-weight: 600; }
.segment-toggle button:hover:not(.active) { color: var(--text); }
.monthly-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.monthly-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
.monthly-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.monthly-table tr:last-child td { border-bottom: none; }
.monthly-table tr:hover td { background: var(--surface-2); }
.monthly-table .month-cell { font-family: var(--font-display); font-weight: 600; color: var(--text); }
.monthly-table tfoot td {
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border-top: 2px solid var(--border);
  border-bottom: none;
}

/* ---------- Admin ---------- */
/* ---------- Admin ---------- */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.admin-tabs a {
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  transition: all .15s;
}
.admin-tabs a:hover { color: var(--text); background: var(--surface); }
.admin-tabs a.active { background: var(--accent); color: #1a1305; }

.hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.hub-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  transition: border-color .15s, transform .15s;
}
.hub-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.hub-card h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 8px; color: var(--text); }
.hub-card p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }

.admin-section { margin-bottom: 36px; }
.admin-section h2 { font-family: var(--font-display); font-size: 17px; margin-bottom: 14px; }
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 12px;
  align-items: end;
}
.grid-form label input, .grid-form label select { width: 100%; }

.member-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.member-row + .member-row { margin-top: 0; }
.member-row-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  align-items: end;
}
.member-row-grid-2 {
  grid-template-columns: 110px 1fr 120px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.member-row-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}
.member-row-grid input { width: 100%; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 13px; white-space: nowrap; }
.checkbox-label input { width: auto; }
input:disabled { opacity: .6; cursor: not-allowed; }

details summary::marker { color: var(--accent); }
details summary:hover { color: var(--text); }

@media (max-width: 720px) {
  .member-row-grid, .member-row-grid-2 { grid-template-columns: 1fr; }
}

.alert {
  padding: 12px 16px;
  border-radius: 9px;
  background: rgba(232,93,93,.12);
  color: var(--bad);
  border: 1px solid rgba(232,93,93,.3);
  margin-bottom: 18px;
  font-size: 14px;
}
.alert-ok { background: rgba(53,208,139,.12); color: var(--good); border-color: rgba(53,208,139,.3); }

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1c2130, var(--bg) 60%);
}
.login-card {
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}
.login-mark-logo {
  height: 72px;
  width: auto;
  display: block;
  margin: 0 auto 14px;
}
.login-card h1 { font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 22px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.login-card button { margin-top: 6px; }

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .wrap { padding: 20px 14px 60px; }
  .controls { flex-direction: column; align-items: stretch; }
  .metrics-title { font-size: 16px; letter-spacing: 0.08em; }
  .who { display: none; }
  .summary-bar { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .stat-chip .value { font-size: 14px; }
}

/* ---------- TrackerFlow: menu lateral (estilo TrackGram) ---------- */
.tf-layout { display: flex; gap: 22px; align-items: flex-start; }
.tf-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  position: sticky;
  top: 90px;
}
.tf-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.tf-sidebar a:hover { background: var(--surface-2); color: var(--text); }
.tf-sidebar a.active { background: var(--accent); color: #1a1305; font-weight: 600; }
.tf-sidebar .tf-icon { font-size: 15px; width: 18px; text-align: center; }
.tf-content { flex: 1; min-width: 0; }

.tf-page-header { margin-bottom: 24px; }
.tf-breadcrumb {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}
.tf-page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.tf-page-title .tf-title-sub { color: var(--text-muted); font-weight: 500; font-size: 20px; }

.tf-placeholder {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 50px 20px;
  text-align: center;
  color: var(--text-muted);
}
.tf-placeholder .tf-placeholder-icon { font-size: 34px; margin-bottom: 12px; }

@media (max-width: 900px) {
  .tf-layout { flex-direction: column; }
  .tf-sidebar { width: 100%; position: static; display: flex; overflow-x: auto; gap: 4px; }
  .tf-sidebar a { flex-shrink: 0; }
}

/* ---------- TrackerFlow: cards em grade + modal (reutilizável) ---------- */
.tf-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tf-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; transition: border-color .15s; }
.tf-card:hover { border-color: #3A404F; }
.tf-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.tf-card-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-family: var(--font-mono); }
.tf-card-title { font-family: var(--font-mono); font-size: 15px; font-weight: 600; word-break: break-all; margin-bottom: 2px; }
.tf-card-sub { font-size: 12px; color: var(--text-muted); }
.tf-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.tf-card-actions form { flex: 1; }
.tf-card-actions button { width: 100%; }

.tf-add-card {
  border: 1px dashed var(--border);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  min-height: 140px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  background: none;
  width: 100%;
  font-family: var(--font-body);
  transition: border-color .15s, color .15s;
}
.tf-add-card:hover { border-color: var(--accent); color: var(--accent); }

.tf-modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(10,12,17,.7); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.tf-modal-backdrop.open { display: flex; }
.tf-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; max-width: 420px; width: 100%; max-height: 90vh; overflow-y: auto; }
.tf-modal h3 { margin: 0 0 18px; font-family: var(--font-display); font-size: 17px; }
.tf-modal-close { float: right; background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.tf-modal label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.tf-modal label input, .tf-modal label textarea, .tf-modal label select { width: 100%; }

/* ---------- TrackerFlow: wizard multi-passo (Adicionar Canal) ---------- */
.tf-wizard-modal { max-width: 480px; }
.tf-wizard-eyebrow {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); font-family: var(--font-mono); margin-bottom: 4px;
}
.tf-wizard-steps { display: flex; align-items: center; gap: 6px; margin: 18px 0 22px; }
.tf-wizard-step { display: flex; align-items: center; gap: 8px; }
.tf-wizard-step-circle {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); flex-shrink: 0;
}
.tf-wizard-step.done .tf-wizard-step-circle { background: var(--accent); color: #1a1305; border-color: var(--accent); }
.tf-wizard-step.active .tf-wizard-step-circle { border-color: var(--accent); color: var(--accent); }
.tf-wizard-step-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tf-wizard-step.active .tf-wizard-step-label, .tf-wizard-step.done .tf-wizard-step-label { color: var(--text); }
.tf-wizard-line { flex: 1; height: 1px; background: var(--border); margin: 0 2px; }

.tf-wizard-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.tf-wizard-box-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: 14px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.tf-wizard-ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tf-wizard-ol li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.tf-wizard-ol .num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #1a1305;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.tf-wizard-note {
  font-size: 11px; color: var(--text-muted);
  background: rgba(242,184,75,.08);
  border: 1px solid rgba(242,184,75,.25);
  border-radius: 8px; padding: 8px 10px; margin-top: 6px;
}
.tf-wizard-warn {
  font-size: 12px; color: var(--warn);
  background: rgba(242,184,75,.08);
  border: 1px solid rgba(242,184,75,.3);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.tf-wizard-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 14px; cursor: pointer; }
.tf-wizard-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-muted); }
.tf-wizard-field input, .tf-wizard-field select { width: 100%; }
.tf-wizard-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.tf-wizard-actions .spacer { flex: 1; }

.tf-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tf-tabs button, .tf-tabs a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-family: var(--font-body);
  font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.tf-tabs button:hover, .tf-tabs a:hover { color: var(--text); border-color: #3A404F; }
.tf-tabs button.active, .tf-tabs a.active { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.tf-tabs button .pill, .tf-tabs a .pill { margin: 0; }
.tf-panel { display: none; }
.tf-panel.active { display: block; }

/* ---------- Suporte: Livechat ---------- */
.lc-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: calc(100vh - 220px); min-height: 480px; }
.lc-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.lc-search { padding: 10px; border-bottom: 1px solid var(--border); }
.lc-search input { width: 100%; }
.lc-items { flex: 1; overflow-y: auto; }
.lc-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.lc-item:hover { background: var(--surface-2); }
.lc-item.active { background: var(--surface-2); border-left: 3px solid var(--accent); }
.lc-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; overflow: hidden; }
.lc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lc-item-body { flex: 1; min-width: 0; }
.lc-item-top { display: flex; justify-content: space-between; gap: 6px; }
.lc-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-item-time { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.lc-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.lc-unread { background: var(--accent); color: #1a1305; border-radius: 999px; font-size: 10px; font-weight: 700; padding: 1px 6px; margin-left: 6px; }
.lc-thread { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.lc-thread-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px; }
.lc-thread-title { font-size: 14px; font-weight: 700; }
.lc-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.lc-bubble { max-width: 65%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.lc-bubble.in { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.lc-bubble.out { align-self: flex-end; background: #2a4a6b; border-bottom-right-radius: 4px; }
.lc-bubble-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-align: right; }
.lc-compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: center; }
.lc-compose input[type="text"] { flex: 1; }
.lc-compose #lcComposeMic.recording { background: var(--bad); color: #fff; border-color: var(--bad); animation: lc-pulse 1s infinite; }
@keyframes lc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

.lc-media-img { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; margin-bottom: 4px; }
.lc-media-video { max-width: 260px; border-radius: 10px; display: block; margin-bottom: 4px; }
.lc-media-video.lc-media-round { border-radius: 50%; width: 200px; height: 200px; object-fit: cover; }
.lc-media-audio { display: block; margin-bottom: 4px; max-width: 240px; }
.lc-media-doc { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(255,255,255,.05); border-radius: 8px; text-decoration: none; color: inherit; font-size: 12px; margin-bottom: 4px; }

.lc-quick-panel {
  position: absolute; bottom: 42px; left: 0;
  width: 280px; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 20;
}
.lc-quick-item {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; text-align: left; padding: 10px 12px;
  border: none; border-bottom: 1px solid var(--border);
  background: none; color: var(--text); cursor: pointer; font-family: var(--font-body);
}
.lc-quick-item:last-child { border-bottom: none; }
.lc-quick-item:hover { background: var(--surface-2); }
.lc-quick-item strong { font-size: 12px; }
.lc-quick-item span { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-quick-new {
  display: block; width: 100%; text-align: center;
  padding: 10px 12px; border: none; border-bottom: 1px solid var(--border);
  background: var(--surface-2); color: var(--accent); font-weight: 600; font-size: 12px; cursor: pointer;
}
.lc-quick-new:hover { filter: brightness(1.1); }
.lc-quick-item-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.lc-quick-item-row:last-child { border-bottom: none; }
.lc-quick-item-row .lc-quick-item { border-bottom: none; flex: 1; }
.lc-quick-del {
  border: none; background: none; color: var(--text-muted);
  font-size: 16px; padding: 0 12px; cursor: pointer; line-height: 1;
}
.lc-quick-del:hover { color: var(--bad); }
.lc-quick-form { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.lc-quick-form input, .lc-quick-form textarea { width: 100%; font-size: 12px; }
.lc-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; }
.lc-mode-badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; cursor: pointer; border: none; }
.lc-mode-badge.bot { background: rgba(139,92,246,.15); color: #a78bfa; }
.lc-mode-badge.operator { background: rgba(53,208,139,.15); color: var(--good); }

/* ---------- TrackerFlow: Landing Page (3 colunas) ---------- */
.tf-landing-columns { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .tf-landing-columns { grid-template-columns: 1fr; } }
.tf-landing-col { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.tf-landing-col-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.tf-landing-col-title { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tf-code-block {
  background: #0F1218;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #9fd8ff;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}
.tf-selected-channel-box {
  display: flex; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px;
}
.tf-selected-channel-box .val { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
/* ---------- Kit de ícones (substitui emojis) ---------- */
.tf-icon-svg { color: var(--accent); vertical-align: middle; flex-shrink: 0; }
.tf-icon-svg.muted { color: var(--text-muted); }
.tf-icon-svg.good { color: var(--good); }
.tf-icon-svg.bad { color: var(--bad); }
.icon-inline { display: inline-flex; align-items: center; gap: 6px; }
/* ---------- Modal de confirmação de exclusão ---------- */
#confirmDeleteBtn:disabled { opacity: .35; cursor: not-allowed; }
#confirmDeleteInput { width: 100%; margin-top: 4px; }

/* ---------- Panorama: legível, mas compacto o bastante pra não estourar a tela ---------- */
.panorama-card { padding: 18px 20px; height: auto; }
.panorama-card-title { font-size: 16px; font-weight: 700; font-family: var(--font-display); margin: 0; }
.panorama-tier-badge { font-size: 11px; padding: 4px 11px; font-weight: 700; }
.panorama-table th { font-size: 11px; padding: 8px 8px; }
.panorama-table td { padding: 10px 8px; vertical-align: top; }
.panorama-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  display: block;
  white-space: nowrap;
}
.panorama-value.good { color: var(--good); }
.panorama-value.warn { color: var(--warn); }
.panorama-value.bad { color: var(--bad); }
.panorama-value.none { color: var(--text); }
.panorama-meta { font-size: 10px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.panorama-spend { font-size: 11px; margin-top: 10px; margin-bottom: 0; }
.panorama-summary .stat-chip .value { font-size: 18px; }
.panorama-summary .stat-chip .label { font-size: 12px; }

/* Diagnóstico + Tratativa: caixa embaixo dos dados, largura total —
   mesmo formato do relatório exportado */
.panorama-analysis {
  width: 100%;
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.panorama-analysis-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin: 0 0 8px; display: flex; align-items: center; gap: 5px;
}
.panorama-analysis-text { font-size: 12px; line-height: 1.65; color: var(--text); margin: 0; }
.panorama-tratativa-list { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.6; color: var(--text); }
.panorama-tratativa-list li { margin-bottom: 8px; }
.panorama-tratativa-list li:last-child { margin-bottom: 0; }
.panorama-tratativa-list li::marker { color: var(--bad); }

@media (max-width: 720px) {
  .panorama-value { font-size: 15px; }
  .panorama-card { padding: 14px; }
}

/* ---------- Árvore expansível (Meta Ads: Conta/Campanha/Conjunto/Anúncio) ---------- */
.tree-chevron { display: inline-flex; transition: transform .15s; vertical-align: middle; }