/* ==========================================================================
   Sendy UI — Design System
   Tokens, layout e componentes. Tudo em CSS puro, sem dependências externas.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Marca — verde institucional AlwaysFit, com o 500 amostrado do logo oficial. */
  --brand-50: #e8f7f0;
  --brand-100: #cfeee0;
  --brand-200: #a7e0c6;
  --brand-300: #6fcfa1;
  --brand-400: #34b97e;
  --brand-500: #26a36d;
  --brand-600: #1c8a5b;
  --brand-700: #146b46;
  --brand-800: #0f5537;
  --brand-900: #0b422b;

  /* Estados */
  --success-50: #e8faf1;
  --success-500: #10b981;
  --success-600: #059669;
  --warning-50: #fff6e6;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --danger-50: #ffeef0;
  --danger-500: #f43f5e;
  --danger-600: #e11d48;
  --info-50: #e8f4ff;
  --info-500: #0ea5e9;
  --info-600: #0284c7;

  /* Buckets de engajamento — usados no seletor de público e nos gráficos */
  --eng-hot: #f43f5e;
  --eng-hot-soft: #ffe9ed;
  --eng-warm: #f59e0b;
  --eng-warm-soft: #fff3e0;
  --eng-cooling: #0ea5e9;
  --eng-cooling-soft: #e6f4fe;
  --eng-cold: #6366f1;
  --eng-cold-soft: #eceefe;
  --eng-never: #94a3b8;
  --eng-never-soft: #eef1f5;
  --eng-new: #10b981;
  --eng-new-soft: #e6f8f0;

  /* Superfícies (tema claro) */
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f1f3f9;
  --surface-inset: #f6f7fb;
  --sidebar-bg: #14121f;
  --sidebar-grad: linear-gradient(180deg, #1d1a2e 0%, #161428 48%, #100e1b 100%);
  --sidebar-fg: #a09db5;
  --sidebar-fg-strong: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, .06);
  --sidebar-active: rgba(38, 163, 109, .22);

  /* Texto */
  --text: #16151f;
  --text-secondary: #5c5b6b;
  --text-muted: #8b8a9a;
  --text-inverse: #ffffff;

  /* Bordas */
  --border: #e6e7ee;
  --border-strong: #d3d5e0;
  --focus-ring: 0 0 0 3px rgba(38, 163, 109, .28);

  /* Raio */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Sombra */
  --shadow-xs: 0 1px 2px rgba(20, 18, 31, .05);
  --shadow-sm: 0 1px 3px rgba(20, 18, 31, .07), 0 1px 2px rgba(20, 18, 31, .04);
  --shadow-md: 0 4px 14px rgba(20, 18, 31, .08), 0 1px 3px rgba(20, 18, 31, .04);
  --shadow-lg: 0 18px 40px rgba(20, 18, 31, .13), 0 4px 12px rgba(20, 18, 31, .06);
  --shadow-pop: 0 24px 60px rgba(20, 18, 31, .18);

  /* Layout */
  --sidebar-gap: 10px;
  --sidebar-panel-w: 252px;
  --sidebar-w: calc(var(--sidebar-panel-w) + var(--sidebar-gap) * 2);
  --topbar-h: 64px;
  --content-max: 1520px;

  /* Tipografia */
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

body.is-rail { --sidebar-panel-w: 74px; }

[data-theme="dark"] {
  --bg: #0e0d14;
  --bg-elevated: #17161f;
  --surface: #17161f;
  --surface-2: #1d1c27;
  --surface-3: #24222f;
  --surface-inset: #121119;
  --sidebar-bg: #100f17;
  --sidebar-grad: linear-gradient(180deg, #1a1826 0%, #141221 48%, #0f0e17 100%);
  --sidebar-fg: #8d8b9e;
  --sidebar-fg-strong: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, .05);
  --sidebar-active: rgba(52, 185, 126, .2);

  --text: #f2f2f6;
  --text-secondary: #a5a3b5;
  --text-muted: #74728a;

  --border: #262433;
  --border-strong: #34313f;

  --brand-50: #10291f;
  --brand-100: #163527;

  --success-50: #10281f;
  --warning-50: #2b2113;
  --danger-50: #2c1620;
  --info-50: #10222f;

  --eng-hot-soft: #331722;
  --eng-warm-soft: #2f2413;
  --eng-cooling-soft: #10222f;
  --eng-cold-soft: #1d1c3a;
  --eng-never-soft: #22212c;
  --eng-new-soft: #0f2921;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .55);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, .65);
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* html também precisa do --bg: com height:100% no body, a área além do
   viewport (overscroll / páginas curtas) pintava o default branco do UA. */
html {
  min-height: 100%;
  background: var(--bg);
  background-color: var(--bg);
}
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

html, body { min-height: 100%; min-height: 100dvh; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 640; letter-spacing: -.018em; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--brand-500); text-decoration: none; }
a:hover { color: var(--brand-600); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

/* --------------------------------------------------------------------------
   3. Utilitários
   -------------------------------------------------------------------------- */
.u-row { display: flex; align-items: center; }
.u-row-top { display: flex; align-items: flex-start; }
.u-between { display: flex; align-items: center; justify-content: space-between; }
.u-col { display: flex; flex-direction: column; }
.u-wrap { flex-wrap: wrap; }
.u-gap-2 { gap: 2px; } .u-gap-4 { gap: 4px; } .u-gap-6 { gap: 6px; }
.u-gap-8 { gap: 8px; } .u-gap-10 { gap: 10px; } .u-gap-12 { gap: 12px; }
.u-gap-14 { gap: 14px; }
.u-gap-16 { gap: 16px; } .u-gap-20 { gap: 20px; } .u-gap-24 { gap: 24px; }
.u-grow { flex: 1 1 auto; min-width: 0; }
.u-right { margin-left: auto; }
.u-center { justify-content: center; }
.u-mt-4 { margin-top: 4px; } .u-mt-8 { margin-top: 8px; } .u-mt-12 { margin-top: 12px; }
.u-mt-16 { margin-top: 16px; } .u-mt-20 { margin-top: 20px; } .u-mt-24 { margin-top: 24px; }
.u-mb-8 { margin-bottom: 8px; } .u-mb-12 { margin-bottom: 12px; } .u-mb-16 { margin-bottom: 16px; }
.u-mb-20 { margin-bottom: 20px; } .u-mb-24 { margin-bottom: 24px; }
.u-full { width: 100%; }
.u-nowrap { white-space: nowrap; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-mono { font-family: var(--font-mono); font-size: .92em; }
.u-tnum { font-variant-numeric: tabular-nums; }
.u-hide { display: none !important; }

.t-sm { font-size: 13px; }
.t-xs { font-size: 12px; }
.t-2xs { font-size: 11px; }
.t-lg { font-size: 16px; }
.t-secondary { color: var(--text-secondary); }
.t-muted { color: var(--text-muted); }
.t-strong { font-weight: 600; }
.t-bold { font-weight: 680; }
.t-up { text-transform: uppercase; letter-spacing: .07em; }
.t-success { color: var(--success-600); }
.t-danger { color: var(--danger-600); }
.t-warning { color: var(--warning-600); }
.t-brand { color: var(--brand-500); }
.t-right { text-align: right; }
.t-center { text-align: center; }

/* --------------------------------------------------------------------------
   4. Layout da aplicação
   -------------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; background: var(--bg); }

/* ---------------------------- Sidebar ----------------------------
   Painel flutuante com cantos arredondados. O modo compacto (rail) é
   ativado por .is-rail no <body>, que reduz --sidebar-panel-w e faz o
   conteúdo principal acompanhar sozinho. */
.sidebar {
  /* Tokens da sidebar — valores para tema escuro (padrão). O tema claro
     sobrescreve estes em [data-theme="light"] .sidebar, mais abaixo. */
  --side-grad: var(--sidebar-grad);
  --side-border: rgba(255, 255, 255, .07);
  --side-glow: rgba(52, 185, 126, .26);
  --side-shadow: 0 22px 50px rgba(15, 13, 25, .22), inset 0 1px 0 rgba(255, 255, 255, .06);
  --side-fg: var(--sidebar-fg);
  --side-fg-strong: #ffffff;
  --side-card: rgba(255, 255, 255, .045);
  --side-card-border: rgba(255, 255, 255, .06);
  --side-hover: rgba(255, 255, 255, .055);
  --side-hover-strong: rgba(255, 255, 255, .1);
  --side-icon-bg: rgba(255, 255, 255, .045);
  --side-icon-fg: #b6b3c9;
  --side-title: #6a6780;
  --side-rule: rgba(255, 255, 255, .08);
  --side-badge-bg: rgba(255, 255, 255, .1);
  --side-badge-fg: #d9d7e6;
  --side-active-bg: linear-gradient(90deg, rgba(38, 163, 109, .34), rgba(38, 163, 109, .07));
  --side-active-ring: rgba(52, 185, 126, .24);
  --side-active-fg: #ffffff;
  --side-star: #f5b301;
  --side-dot-border: #17152a;
  --side-scroll: rgba(255, 255, 255, .14);

  position: fixed;
  /* top + bottom (em vez de só 100vh): no mobile a barra do browser
     faz 100vh ficar maior que a área visível e escondia o rodapé com
     o menu do usuário (Configurações / Sair). */
  top: var(--sidebar-gap);
  bottom: var(--sidebar-gap);
  left: var(--sidebar-gap);
  height: auto;
  max-height: calc(100dvh - var(--sidebar-gap) * 2);
  width: var(--sidebar-panel-w);
  border-radius: 20px;
  background: var(--side-grad);
  border: 1px solid var(--side-border);
  box-shadow: var(--side-shadow);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: width .24s var(--ease), transform .24s var(--ease);
}
/* Brilho sutil no topo do painel. */
.sidebar::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 190px;
  border-radius: 20px 20px 0 0;
  background: radial-gradient(120% 100% at 50% 0%, var(--side-glow), transparent 68%);
  pointer-events: none;
}

/* Tema claro: sidebar clara. */
[data-theme="light"] .sidebar {
  --side-grad: linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%);
  --side-border: var(--border);
  --side-glow: rgba(38, 163, 109, .10);
  --side-shadow: var(--shadow-md);
  --side-fg: #6b6a7c;
  --side-fg-strong: #1a1926;
  --side-card: #f4f5f9;
  --side-card-border: #ecedf3;
  --side-hover: #f2f3f8;
  --side-hover-strong: #eceef4;
  --side-icon-bg: #eef0f6;
  --side-icon-fg: #6b6a7c;
  --side-title: #a2a0b0;
  --side-rule: var(--border);
  --side-badge-bg: #eceef4;
  --side-badge-fg: #5c5b6b;
  --side-active-bg: linear-gradient(90deg, rgba(38, 163, 109, .14), rgba(38, 163, 109, .02));
  --side-active-ring: rgba(38, 163, 109, .2);
  --side-active-fg: var(--brand-700);
  --side-star: #f5a301;
  --side-dot-border: #ffffff;
  --side-scroll: var(--border-strong);
}

/* Seletor de marca / workspace */
.ws {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 12px 12px 8px; padding: 8px;
  border-radius: 14px;
  background: var(--side-card);
  border: 1px solid var(--side-card-border);
  color: var(--side-fg-strong); cursor: pointer; text-align: left;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.ws:hover { background: var(--side-hover-strong); }
/* Marca com o mesmo tratamento da tela de entrada: aro girando sobre o tile. */
.ws__logo { position: relative; width: 34px; height: 34px; flex: 0 0 34px; }
.ws__logo-ring {
  position: absolute; inset: -3px;
  border-radius: 14px; padding: 2px;
  background: conic-gradient(from 0deg, transparent 0 52%, var(--brand-300) 74%, var(--brand-400) 88%, transparent 97%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: spin 4.5s linear infinite;
}
.ws__logo-face {
  position: absolute; inset: 0;
  border-radius: 11px; overflow: hidden;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-500) 58%, var(--brand-700));
  box-shadow: 0 4px 14px rgba(38, 163, 109, .45), inset 0 1px 0 rgba(255, 255, 255, .26);
}
.ws__logo-face img { width: 100%; height: 100%; object-fit: cover; }
.ws__logo-svg {
  width: 58%; height: 58%;
  filter: drop-shadow(0 1px 2px rgba(9, 60, 39, .3));
  animation: mark-in .7s var(--ease) both;
}
.ws__text { min-width: 0; flex: 1 1 auto; }
.ws__name { font-size: 13.5px; font-weight: 640; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws__meta { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--side-fg); margin-top: 1px; }
.ws__meta i { width: 6px; height: 6px; border-radius: 50%; background: var(--success-500); display: block; box-shadow: 0 0 0 2.5px rgba(16, 185, 129, .2); }
.ws__chev { width: 15px; height: 15px; flex: 0 0 15px; color: var(--side-fg); }

/* CTA principal */
.sidebar__cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 0 12px 10px; height: 40px;
  border-radius: 12px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff; font-size: 13.5px; font-weight: 620;
  box-shadow: 0 6px 18px rgba(38, 163, 109, .42);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease);
}
.sidebar__cta:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 10px 24px rgba(38, 163, 109, .52); }
.sidebar__cta:active { transform: translateY(1px); }
.sidebar__cta svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* min-height: 0 deixa a área de nav encolher no flex e o rodapé
   (usuário / Configurações / Sair) permanecer sempre visível. */
.sidebar__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 12px 14px; }
.sidebar__scroll::-webkit-scrollbar { width: 6px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: var(--side-scroll); border: 0; border-radius: 99px; }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 8px; }

/* Título do grupo = botão que recolhe/expande. */
.nav-group__title {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--side-title); padding: 6px 10px 4px; margin: 0;
  transition: color .15s var(--ease);
  font-family: inherit;
}
.nav-group__title:hover { color: var(--side-fg-strong); }
.nav-group__title > span { display: inline-flex; align-items: center; gap: 6px; }
.nav-group__staricon { width: 12px; height: 12px; color: var(--side-star); }
.nav-group__caret { width: 13px; height: 13px; opacity: .55; transition: transform .2s var(--ease); }
.nav-group.is-collapsed .nav-group__caret { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-list { display: none; }
.nav-group__rule { display: none; height: 1px; background: var(--side-rule); margin: 12px 14px; border-radius: 1px; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 8px 0 10px;
  border-radius: 11px;
  color: var(--side-fg); font-size: 13.5px; font-weight: 520;
  transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.nav-item__ico {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 8px; display: grid; place-items: center;
  background: var(--side-icon-bg);
  color: var(--side-icon-fg);
  transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.nav-item__ico svg { width: 15px; height: 15px; }
.nav-item__label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-item:hover { background: var(--side-hover); color: var(--side-fg-strong); }
.nav-item:hover .nav-item__ico { background: var(--side-hover-strong); color: var(--side-fg-strong); }

.nav-item.is-active {
  color: var(--side-active-fg); font-weight: 620;
  background: var(--side-active-bg);
  box-shadow: inset 0 0 0 1px var(--side-active-ring);
}
.nav-item.is-active .nav-item__ico {
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff;
  box-shadow: 0 3px 10px rgba(38, 163, 109, .55);
}

.nav-badge {
  font-size: 10.5px; font-weight: 700; line-height: 1.6;
  background: var(--side-badge-bg); color: var(--side-badge-fg);
  padding: 0 7px; border-radius: var(--r-full);
}
.nav-badge.is-brand { background: var(--brand-500); color: #fff; box-shadow: 0 2px 8px rgba(38, 163, 109, .5); }
.nav-badge.is-danger { background: var(--danger-500); color: #fff; box-shadow: 0 2px 8px rgba(244, 63, 94, .45); }

/* Estrela de favorito. */
.nav-fav {
  flex: 0 0 auto; width: 22px; height: 22px; margin-left: 4px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--side-fg);
  opacity: 0;
  transition: opacity .15s var(--ease), background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.nav-fav svg { width: 14px; height: 14px; }
.nav-fav:hover { background: var(--side-hover-strong); color: var(--side-star); transform: scale(1.12); }
.nav-item:hover .nav-fav { opacity: .75; }
.nav-fav.is-fav { opacity: 1; color: var(--side-star); }
.is-fav-group .nav-fav { opacity: 1; }

/* Rodapé: cota, usuário e botão de recolher.
   overflow visível para o dropup (Configurações / Sair) não ser clipado. */
.sidebar__footer {
  flex: 0 0 auto;
  min-width: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--side-rule);
  overflow: visible;
}
.quota-card {
  background: var(--side-card);
  border: 1px solid var(--side-card-border);
  border-radius: 13px; padding: 11px 12px;
  min-width: 0;
}
.quota-card__label { font-size: 10px; color: var(--side-fg); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.quota-card__value { color: var(--side-fg-strong); font-weight: 660; font-size: 14.5px; margin-top: 3px; letter-spacing: -.02em; }
.quota-card .bar { background: var(--side-hover-strong); }

.side-user {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 100%; min-width: 0;
  margin: 0; padding: 7px 8px;
  border: 1px solid var(--side-card-border);
  border-radius: 12px; cursor: pointer;
  background: var(--side-card);
  color: var(--side-fg-strong);
  text-align: left;
  box-sizing: border-box;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.side-user:hover { background: var(--side-hover); }
.side-user__text { min-width: 0; overflow: hidden; }
.side-user__name {
  font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user__role {
  font-size: 11px; color: var(--side-fg);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user > .avatar { flex: 0 0 auto; }
.side-user > svg,
.side-user > [data-icon] { flex: 0 0 15px; width: 15px; height: 15px; color: var(--side-fg); }
.side-user svg { width: 15px; height: 15px; color: var(--side-fg); }

.sidebar__collapse {
  width: 100%; max-width: 100%; height: 32px; margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--side-title);
  font-size: 12px; font-weight: 560;
  box-sizing: border-box;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.sidebar__collapse:hover { background: var(--side-hover); color: var(--side-fg-strong); }
.sidebar__collapse svg { width: 15px; height: 15px; transition: transform .24s var(--ease); }

/* -------- Gaveta (mobile) --------
   O botão de fechar fica fora do painel, sobre o véu, e desliza junto: dentro
   ele disputaria espaço com o seletor de marca e o chevron do dropdown. */
.sidebar__close {
  position: absolute; top: 4px; left: calc(100% + 12px);
  width: 38px; height: 38px;
  display: none; place-items: center;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px;
  background: rgba(20, 18, 31, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff; cursor: pointer;
}
.sidebar__close svg { width: 18px; height: 18px; }

.nav-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 55;
  background: rgba(15, 13, 25, .5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .26s var(--ease);
}
.nav-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* -------- Modo compacto (rail) -------- */
body.is-rail .ws { justify-content: center; padding: 8px 0; }
body.is-rail .ws__text,
body.is-rail .ws__chev,
body.is-rail .nav-item__label,
body.is-rail .nav-badge,
body.is-rail .nav-fav,
body.is-rail .nav-group__title,
body.is-rail .is-fav-group,
body.is-rail .quota-card,
body.is-rail .side-user__text,
body.is-rail .side-user svg,
body.is-rail .sidebar__collapse span,
body.is-rail .sidebar__cta span { display: none; }

/* No rail, grupos recolhidos voltam a mostrar seus itens (o rótulo some). */
body.is-rail .nav-group.is-collapsed .nav-list { display: flex; }
body.is-rail .nav-group__rule { display: block; }
body.is-rail .nav-group + .nav-group { margin-top: 0; }
body.is-rail .sidebar__cta { margin: 0 auto 10px; width: 40px; padding: 0; }
body.is-rail .sidebar__scroll { overflow: visible; padding: 4px 12px 14px; }
body.is-rail .nav-item { justify-content: center; padding: 0; gap: 0; }
body.is-rail .side-user { justify-content: center; }
body.is-rail .sidebar__collapse svg { transform: rotate(180deg); }
body.is-rail .sidebar__footer { padding: 10px 8px 12px; }

/* Sem espaço para o badge no rail: vira um ponto sobre o ícone. */
body.is-rail .nav-item[data-badge] .nav-item__ico::after {
  content: ""; position: absolute; top: 4px; right: 12px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-400); border: 2px solid var(--side-dot-border);
}
body.is-rail .nav-item[data-badge="danger"] .nav-item__ico::after { background: var(--danger-500); }

/* Tooltip no modo compacto */
body.is-rail .nav-item::after,
body.is-rail .sidebar__cta::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 14px); top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 6px 10px; border-radius: 9px;
  background: #221f31; color: #fff;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px; font-weight: 560; white-space: nowrap;
  opacity: 0; pointer-events: none; z-index: 70;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
body.is-rail .sidebar__cta { position: relative; }
body.is-rail .nav-item:hover::after,
body.is-rail .sidebar__cta:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

/* Área principal */
.main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--bg);
  transition: margin-left .22s var(--ease);
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__search {
  position: relative; flex: 0 1 420px; max-width: 420px;
}
.topbar__search > i,
.topbar__search > [data-icon],
.topbar__search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
  display: block; margin: 0; padding: 0; line-height: 0; pointer-events: none;
}
.topbar__search > i svg,
.topbar__search > [data-icon] svg {
  position: static; transform: none; width: 16px; height: 16px;
}
.topbar__search input {
  display: block; width: 100%; height: 38px; margin: 0; padding: 0 12px 0 34px; line-height: 1.25;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.topbar__search input::placeholder { color: var(--text-muted); }
.topbar__search input:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--focus-ring); }
.topbar__search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-3); border-radius: var(--r-xs); padding: 2px 6px;
}

.icon-btn {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-secondary);
  cursor: pointer; position: relative;
  transition: all .15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn__dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger-500); border: 2px solid var(--surface); }

/* O botão de menu só existe na faixa em que a sidebar é gaveta. */
.topbar__menu { display: none; }

.avatar {
  width: 34px; height: 34px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff; font-weight: 700; font-size: 12.5px; flex: 0 0 34px;
}
.avatar.is-sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10.5px; }
.avatar.is-lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; }

/* Seletor de marca */
.brand-switch {
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer;
  transition: all .15s var(--ease);
}
.brand-switch:hover { border-color: var(--border-strong); background: var(--surface-2); }
.brand-switch__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); }
.brand-switch svg { width: 14px; height: 14px; color: var(--text-muted); }

/* Conteúdo */
.content {
  flex: 1 1 auto;
  padding: 24px;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
.content.is-narrow { max-width: 1120px; }

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head__text { flex: 1 1 320px; min-width: 0; }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-head p { color: var(--text-secondary); margin-top: 4px; font-size: 13.5px; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head__form { display: flex; align-items: center; margin: 0; }

/* Troca de lista direto no título: o gatilho herda o tipo do h1 e o painel
   volta ao tamanho de texto normal para caber nome + contagem. */
.list-switch { position: relative; display: inline-flex; min-width: 0; }
.list-switch__toggle {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  max-width: min(460px, 60vw); margin-left: -8px; padding: 2px 8px;
  font: inherit; color: inherit; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.list-switch__toggle:hover { background: var(--surface-2); border-color: var(--border); }
.list-switch__toggle:focus-visible { outline: none; border-color: var(--brand-400); box-shadow: var(--focus-ring); }
.list-switch__current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-switch__toggle svg {
  flex: 0 0 auto; width: 18px; height: 18px; color: var(--text-muted);
  transition: transform .18s var(--ease);
}
.list-switch.is-open .list-switch__toggle { background: var(--surface-2); border-color: var(--border); }
.list-switch.is-open .list-switch__toggle svg { transform: rotate(180deg); }

.list-switch__panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 80;
  width: min(360px, 86vw); padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.list-switch__panel[hidden] { display: none; }

.list-switch__search { position: relative; padding-bottom: 6px; }
.list-switch__search svg {
  position: absolute; left: 11px; top: 17px; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted); pointer-events: none;
}
.list-switch__search input {
  width: 100%; height: 34px; padding: 0 10px 0 32px;
  font-size: 13px; font-weight: 400; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.list-switch__search input:focus {
  outline: none; background: var(--surface);
  border-color: var(--brand-400); box-shadow: var(--focus-ring);
}

.list-switch__items { max-height: 300px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.list-switch__item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-xs);
  color: var(--text); text-decoration: none;
}
.list-switch__item:hover,
.list-switch__item.is-active { background: var(--surface-2); color: var(--text); }
.list-switch__item.is-current { background: var(--brand-50); }
.list-switch__mark { flex: 0 0 16px; display: grid; place-items: center; color: var(--brand-600); opacity: 0; }
.list-switch__mark svg { width: 15px; height: 15px; }
.list-switch__item.is-current .list-switch__mark { opacity: 1; }
.list-switch__text { min-width: 0; }
.list-switch__name {
  display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-switch__meta {
  display: block; font-size: 11.5px; font-weight: 400; line-height: 1.35;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.list-switch__empty { padding: 16px 10px; text-align: center; font-size: 12.5px; font-weight: 400; color: var(--text-muted); }
.list-switch__foot { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.list-switch__foot a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r-xs);
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary); text-decoration: none;
}
.list-switch__foot a:hover { background: var(--surface-2); color: var(--text); }
.list-switch__foot svg { width: 15px; height: 15px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb svg { width: 13px; height: 13px; opacity: .6; }

/* --------------------------------------------------------------------------
   5. Botões
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 580; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  /* A folha legada põe uma sombra em todo `.btn`; as variantes daqui pedem a sua. */
  box-shadow: none;
  transition: all .15s var(--ease);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }

.btn--primary { background: var(--brand-500); color: #fff; box-shadow: 0 1px 2px rgba(38, 163, 109, .35); }
.btn--primary:hover { background: var(--brand-600); color: #fff; box-shadow: 0 4px 12px rgba(38, 163, 109, .35); }

.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }

.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }

.btn--danger { background: var(--danger-500); color: #fff; }
.btn--danger:hover { background: var(--danger-600); color: #fff; }

.btn--success { background: var(--success-500); color: #fff; }
.btn--success:hover { background: var(--success-600); color: #fff; }

.btn--soft { background: var(--brand-50); color: var(--brand-600); }
.btn--soft:hover { background: var(--brand-100); color: var(--brand-700); }

.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn--sm svg { width: 14px; height: 14px; flex-basis: 14px; }
.btn--lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn.is-active {
  background: var(--brand-50); color: var(--brand-600);
  border-color: var(--brand-200); z-index: 1; font-weight: 640;
}
[data-theme="dark"] .btn-group .btn.is-active {
  background: color-mix(in srgb, var(--brand-500) 18%, var(--surface));
  color: var(--brand-300); border-color: color-mix(in srgb, var(--brand-500) 35%, var(--border));
}

/* Controle segmentado */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: var(--r-sm);
}
.segmented button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 13px; border-radius: var(--r-xs);
  font-size: 12.5px; font-weight: 560; color: var(--text-secondary);
  transition: all .15s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: 620; }
.segmented button:disabled { opacity: .4; cursor: not-allowed; }
.segmented button:disabled:hover { color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   6. Cards e superfícies
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card--flush { overflow: hidden; }
.card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.card__head > .u-grow { min-width: 0; }
.card__head .badge {
  flex: 0 1 auto; max-width: 46%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card__head h3 { font-size: 14.5px; }
.card__head p { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.card__body { padding: 18px; min-width: 0; }
.card__body.is-tight { padding: 12px; }
.card__foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1fr) 340px; }
.grid--main-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid--main-aside > * { min-width: 0; }
/* Cards na mesma fileira com a mesma altura */
.grid--main-aside > .card,
.grid--2 > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.grid--main-aside > .card > .card__body,
.grid--main-aside > .card > .table-wrap,
.grid--2 > .card > .card__body {
  flex: 1 1 auto;
}

/* Cartão de métrica */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-md); }
.stat__top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stat__icon {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex: 0 0 30px;
  background: var(--brand-50); color: var(--brand-500);
}
.stat__icon svg { width: 15px; height: 15px; }
.stat__icon.is-success { background: var(--success-50); color: var(--success-500); }
.stat__icon.is-warning { background: var(--warning-50); color: var(--warning-500); }
.stat__icon.is-danger { background: var(--danger-50); color: var(--danger-500); }
.stat__icon.is-info { background: var(--info-50); color: var(--info-500); }
.stat__label { font-size: 12.5px; color: var(--text-secondary); font-weight: 540; }
.stat__value { font-size: 27px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat__value small { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.stat__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.stat__spark { margin-top: 10px; height: 38px; }

.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 12px; border-radius: var(--r-xs); padding: 1px 5px; }
.trend svg { width: 12px; height: 12px; }
.trend.is-up { color: var(--success-600); background: var(--success-50); }
.trend.is-down { color: var(--danger-600); background: var(--danger-50); }
.trend.is-flat { color: var(--text-muted); background: var(--surface-3); }

/* --------------------------------------------------------------------------
   7. Badges, pills e chips
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 620; line-height: 1.7;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutral { background: var(--surface-3); color: var(--text-secondary); }
.badge--brand { background: var(--brand-50); color: var(--brand-600); }
.badge--success { background: var(--success-50); color: var(--success-600); }
.badge--warning { background: var(--warning-50); color: var(--warning-600); }
.badge--danger { background: var(--danger-50); color: var(--danger-600); }
.badge--info { background: var(--info-50); color: var(--info-600); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-secondary); }

.badge--hot { background: var(--eng-hot-soft); color: var(--eng-hot); }
.badge--warm { background: var(--eng-warm-soft); color: var(--eng-warm); }
.badge--cooling { background: var(--eng-cooling-soft); color: var(--eng-cooling); }
.badge--cold { background: var(--eng-cold-soft); color: var(--eng-cold); }
.badge--never { background: var(--eng-never-soft); color: var(--eng-never); }
.badge--new { background: var(--eng-new-soft); color: var(--eng-new); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 6px 0 10px;
  border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid transparent;
  font-size: 12.5px; font-weight: 540; color: var(--text);
}
.chip--brand { background: var(--brand-50); color: var(--brand-700); }
.chip--danger { background: var(--danger-50); color: var(--danger-600); }
.chip__x {
  width: 18px; height: 18px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: inherit; opacity: .55;
}
.chip__x:hover { background: rgba(0, 0, 0, .08); opacity: 1; }
.chip__x svg { width: 11px; height: 11px; }

.dot-status { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-status.is-sent { background: var(--success-500); }
.dot-status.is-draft { background: var(--text-muted); }
.dot-status.is-scheduled { background: var(--info-500); }
.dot-status.is-sending { background: var(--warning-500); box-shadow: 0 0 0 3px var(--warning-50); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* --------------------------------------------------------------------------
   8. Formulários
   -------------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 620; margin-bottom: 6px; color: var(--text);
}
.label .req { color: var(--danger-500); }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }

.input, .select, .textarea {
  width: 100%; height: 38px; margin: 0; padding: 0 12px; line-height: 1.25;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--focus-ring); }
.input:disabled, .select:disabled { background: var(--surface-3); color: var(--text-muted); cursor: not-allowed; }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b8a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-group { display: flex; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group__addon {
  display: grid; place-items: center; padding: 0 12px;
  border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-3); color: var(--text-muted); font-size: 13px; white-space: nowrap;
}
.input-group__addon svg { width: 15px; height: 15px; }
button.input-group__addon { cursor: pointer; }
button.input-group__addon:hover { color: var(--text); background: var(--surface-2); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px; height: 22px; border-radius: var(--r-full);
  background: var(--border-strong); position: relative; flex: 0 0 38px;
  transition: background .18s var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus-ring); }

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px;
  border: 1.5px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); display: grid; place-items: center;
  transition: all .15s var(--ease);
}
.check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(.6); transition: all .15s var(--ease); }
.check input:checked + .check__box { background: var(--brand-500); border-color: var(--brand-500); }
.check input:checked + .check__box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check__box { box-shadow: var(--focus-ring); }
.check--radio .check__box { border-radius: 50%; }
.check input[type="radio"]:checked + .check__box { background: var(--brand-500); border-color: var(--brand-500); box-shadow: inset 0 0 0 3.5px var(--surface); }

/* Área de envio de arquivo: aceita clique e arrasto, com o input escondido. */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 28px 20px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text-secondary);
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.dropzone:hover, .dropzone.is-over, .dropzone.is-filled { border-color: var(--brand-400); background: var(--brand-50); }
.dropzone.is-filled { border-style: solid; }
.dropzone__icon {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; margin-bottom: 4px;
  background: var(--surface-3); color: var(--text-secondary);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.dropzone__icon svg { width: 18px; height: 18px; }
.dropzone:hover .dropzone__icon,
.dropzone.is-over .dropzone__icon,
.dropzone.is-filled .dropzone__icon { background: var(--brand-500); color: #fff; }
.dropzone .hint { margin: 0; }

/* --------------------------------------------------------------------------
   9. Tabelas
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table thead th {
  text-align: left; font-size: 11.5px; font-weight: 640;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table thead th.is-sortable { cursor: pointer; user-select: none; }
.table thead th.is-sortable:hover { color: var(--text); }
.table thead th.is-sortable.is-asc::after,
.table thead th.is-sortable.is-desc::after {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: .7;
}
.table thead th.is-sortable.is-asc::after { content: "↑"; }
.table thead th.is-sortable.is-desc::after { content: "↓"; }
.table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table--compact tbody td { padding: 9px 14px; }
.table td .row-actions { opacity: 0; transition: opacity .15s var(--ease); display: inline-flex; gap: 4px; }
.table tbody tr:hover .row-actions { opacity: 1; }

.cell-title { font-weight: 600; color: var(--text); }
.cell-title:hover { color: var(--brand-500); }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.col-date { white-space: nowrap; width: 1%; }
.cell-date { line-height: 1.25; }
.cell-date__day { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.cell-date__time { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cell-date.is-info .cell-date__time { color: var(--info-600); }
.cell-date.is-warning .cell-date__time { color: var(--warning-600); }
.cell-date.is-danger .cell-date__time { color: var(--danger-600); font-weight: 600; }
.cell-date__empty { color: var(--text-muted); }

/* Relatórios: nome completo com quebra de linha, sem invadir Público. */
#reports-page .reports-col-campaign {
  width: 28%;
  max-width: 320px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#reports-page .reports-camp-title {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
#reports-page .reports-col-audience {
  width: 16%;
  max-width: 180px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#reports-page .reports-col-audience .badge {
  display: inline-flex;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  line-height: 1.3;
  height: auto;
  padding-top: 4px;
  padding-bottom: 4px;
  vertical-align: middle;
}

.code-tag {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%;
}
.code-tag code {
  display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 4px 8px; border-radius: var(--r-xs);
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary);
}
.code-tag .btn.is-copied { color: var(--success-600); }

/* Barra métrica dentro de célula */
.metric-cell { min-width: 108px; }
.metric-cell__top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.metric-cell__val { font-weight: 640; font-variant-numeric: tabular-nums; }
.metric-cell__sub { font-size: 11px; color: var(--text-muted); }

.bar { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 5px; }
.bar__fill { height: 100%; border-radius: 99px; background: var(--brand-500); transition: width .4s var(--ease); }
.bar__fill.is-success { background: var(--success-500); }
.bar__fill.is-warning { background: var(--warning-500); }
.bar__fill.is-danger { background: var(--danger-500); }
.bar__fill.is-info { background: var(--info-500); }

/* Barra empilhada de engajamento */
.stack-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.stack-bar > span { display: block; height: 100%; transition: width .4s var(--ease); }
.stack-bar.is-lg { height: 14px; border-radius: var(--r-xs); }
.stack-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.stack-legend__item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.stack-legend__swatch { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.pick-legend .stack-legend { gap: 10px 16px; }
.pick-legend .stack-legend__item { max-width: 100%; }

/* --------------------------------------------------------------------------
   10. Abas
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs__item {
  padding: 10px 14px; font-size: 13.5px; font-weight: 560;
  color: var(--text-secondary); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: center; gap: 7px;
  transition: all .15s var(--ease);
  background: none; border-top: 0; border-left: 0; border-right: 0;
}
.tabs__item:hover { color: var(--text); }
.tabs__item.is-active { color: var(--brand-500); border-bottom-color: var(--brand-500); font-weight: 640; }
.tabs__item .count {
  font-size: 11px; font-weight: 650; padding: 0 6px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-secondary);
}
.tabs__item.is-active .count { background: var(--brand-50); color: var(--brand-600); }

/* --------------------------------------------------------------------------
   11. Passos (wizard)
   -------------------------------------------------------------------------- */
.steps { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: var(--r-full); }
.step__num {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--text-muted);
}
.step__label { font-size: 13px; font-weight: 560; color: var(--text-muted); }
.step.is-done .step__num { background: var(--success-500); color: #fff; }
.step.is-done .step__label { color: var(--text-secondary); }
.step.is-current { background: var(--brand-50); }
.step.is-current .step__num { background: var(--brand-500); color: #fff; box-shadow: 0 0 0 4px var(--brand-50); }
.step.is-current .step__label { color: var(--brand-700); font-weight: 640; }
.step__sep { width: 22px; height: 1.5px; background: var(--border-strong); border-radius: 2px; }

/* --------------------------------------------------------------------------
   12. Seletor de público (destaque desta release)
   -------------------------------------------------------------------------- */
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-card {
  position: relative; text-align: left; cursor: pointer;
  padding: 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--surface);
  transition: all .17s var(--ease);
}
.mode-card:hover { border-color: var(--brand-300); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.mode-card.is-selected { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(38, 163, 109, .12); }
.mode-card__icon {
  width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-secondary); margin-bottom: 10px;
}
.mode-card.is-selected .mode-card__icon { background: var(--brand-500); color: #fff; }
.mode-card__icon svg { width: 17px; height: 17px; }
.mode-card__title { display: flex; align-items: center; gap: 6px; font-weight: 660; font-size: 14px; }
.mode-card__desc { display: block; font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.45; }
.mode-card__check {
  position: absolute; top: 12px; right: 12px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center;
}
.mode-card.is-selected .mode-card__check { background: var(--brand-500); border-color: var(--brand-500); }
.mode-card__check svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.mode-card.is-selected .mode-card__check svg { opacity: 1; }

/* Cartão de bucket de engajamento */
.eng-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.eng-card {
  position: relative; cursor: pointer; text-align: left;
  padding: 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--surface);
  transition: all .17s var(--ease);
  display: flex; flex-direction: column; gap: 10px;
}
.eng-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--eng-color, var(--border-strong));
  opacity: .8;
}
.eng-card:hover { border-color: var(--eng-color); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.eng-card.is-selected { border-color: var(--eng-color); background: var(--eng-bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--eng-color) 14%, transparent); }
.eng-card__head { display: flex; align-items: flex-start; gap: 10px; }
.eng-card__emoji {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: 16px;
  background: var(--eng-bg); color: var(--eng-color);
}
.eng-card__emoji svg { width: 16px; height: 16px; }
.eng-card__title { font-weight: 640; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.eng-card__rule { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; line-height: 1.4; }
.eng-card__metrics { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eng-card__count { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.eng-card__pct { font-size: 11.5px; color: var(--text-muted); line-height: 1.3; }
.eng-card__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.eng-card__check {
  position: absolute; top: 12px; right: 12px;
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center;
}
.eng-card.is-selected .eng-card__check { background: var(--eng-color); border-color: var(--eng-color); }
.eng-card__check svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.eng-card.is-selected .eng-card__check svg { opacity: 1; }

.eng-hot { --eng-color: var(--eng-hot); --eng-bg: var(--eng-hot-soft); }
.eng-warm { --eng-color: var(--eng-warm); --eng-bg: var(--eng-warm-soft); }
.eng-cooling { --eng-color: var(--eng-cooling); --eng-bg: var(--eng-cooling-soft); }
.eng-cold { --eng-color: var(--eng-cold); --eng-bg: var(--eng-cold-soft); }
.eng-never { --eng-color: var(--eng-never); --eng-bg: var(--eng-never-soft); }
.eng-new { --eng-color: var(--eng-new); --eng-bg: var(--eng-new-soft); }

/* Item de lista selecionável */
.pick-list { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.pick-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .13s var(--ease);
}
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--surface-2); }
.pick-item.is-selected { background: var(--brand-50); }
.pick-item__name { font-weight: 600; font-size: 13.5px; }
.pick-item__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.pick-item__count {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  text-align: right; font-variant-numeric: tabular-nums; min-width: 72px;
}
.pick-item__count b { font-size: 14px; font-weight: 660; line-height: 1.2; }
.pick-item__health {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  min-width: 78px;
}
.pick-item__bar { width: 90px; }

/* Construtor de regras */
.rule-group {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); padding: 12px; position: relative;
}
.rule-group + .rule-group { margin-top: 28px; }
.rule-group + .rule-group::before {
  content: "E"; position: absolute; top: -21px; left: 16px;
  background: var(--brand-500); color: #fff;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 10px; border-radius: var(--r-full);
}
.rule-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-row + .rule-row { margin-top: 8px; }
.rule-row__op {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  width: 34px; flex: 0 0 34px; text-align: center;
}
.rule-row .select, .rule-row .input { width: auto; flex: 1 1 150px; min-width: 120px; background: var(--surface); }

/* Painel de resumo do público */
.audience-summary { position: sticky; top: calc(var(--topbar-h) + 24px); }
.audience-total {
  text-align: center; padding: 20px 16px;
  background: linear-gradient(160deg, var(--brand-500), var(--brand-700));
  border-radius: var(--r-lg) var(--r-lg) 0 0; color: #fff;
}
.audience-total__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; opacity: .8; font-weight: 620; }
.audience-total__value { font-size: 40px; font-weight: 760; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; color: #fff; }
.audience-total__sub { font-size: 12.5px; opacity: .82; }

.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; }
.summary-row + .summary-row { border-top: 1px dashed var(--border); }
.summary-row__label { color: var(--text-secondary); display: flex; align-items: center; gap: 7px; }
.summary-row__value { font-weight: 640; font-variant-numeric: tabular-nums; }

.callout {
  display: flex; gap: 10px; padding: 12px 14px;
  border-radius: var(--r-md); font-size: 12.5px; line-height: 1.5;
  border: 1px solid transparent;
}
.callout svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.callout--info { background: var(--info-50); color: var(--info-600); border-color: color-mix(in srgb, var(--info-500) 20%, transparent); }
.callout--warning { background: var(--warning-50); color: var(--warning-600); border-color: color-mix(in srgb, var(--warning-500) 22%, transparent); }
.callout--success { background: var(--success-50); color: var(--success-600); border-color: color-mix(in srgb, var(--success-500) 20%, transparent); }
.callout--danger { background: var(--danger-50); color: var(--danger-600); border-color: color-mix(in srgb, var(--danger-500) 20%, transparent); }
.callout b { font-weight: 680; }

/* --------------------------------------------------------------------------
   13. Gráficos
   -------------------------------------------------------------------------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; }
.chart-legend__item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.chart-legend__swatch { width: 10px; height: 10px; border-radius: 3px; }

.donut-center { text-align: center; }
.donut-center__value { font-size: 24px; font-weight: 720; letter-spacing: -.03em; }
.donut-center__label { font-size: 11.5px; color: var(--text-muted); }

/* Heatmap de horários
   Evita aspect-ratio nas células: em CSS Grid isso faz o paint estourar a
   track e cobrir a legenda / sair do card. A proporção fica no container. */
#heatmap {
  width: 100%;
  min-width: 0;
}
.heat {
  --heat-cols: 25; /* 1 rótulo + 24 horas */
  --heat-rows: 8;  /* 1 cabeçalho + 7 dias */
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 28px repeat(24, minmax(0, 1fr));
  grid-template-rows: 14px repeat(7, minmax(0, 1fr));
  gap: 2px;
  aspect-ratio: var(--heat-cols) / var(--heat-rows);
  max-height: none;
}
.heat__hlabel {
  font-size: 9px; color: var(--text-muted);
  text-align: center; line-height: 14px;
  align-self: stretch;
}
.heat__rlabel {
  font-size: 10px; color: var(--text-muted);
  display: flex; align-items: center;
  min-width: 0; min-height: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.heat__cell {
  min-width: 0; min-height: 0;
  width: 100%; height: 100%;
  border-radius: 2px;
  background: var(--surface-3);
  transition: filter .12s var(--ease);
}
.heat__cell:hover { filter: brightness(1.25); z-index: 2; }

.heat-legend {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px;
  font-size: 12px; color: var(--text-muted);
  position: relative; z-index: 1;
}
.heat-legend__swatches { display: flex; gap: 3px; }
.heat-legend__swatches i {
  width: 12px; height: 12px; border-radius: 3px; display: block;
}

/* Funil */
.funnel__row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.funnel__label { width: 130px; flex: 0 0 130px; font-size: 12.5px; color: var(--text-secondary); }
.funnel__track { flex: 1 1 auto; height: 26px; background: var(--surface-3); border-radius: var(--r-xs); overflow: hidden; }
.funnel__fill { height: 100%; border-radius: var(--r-xs); display: flex; align-items: center; padding-left: 9px; color: #fff; font-size: 12px; font-weight: 640; }
.funnel__value { width: 92px; flex: 0 0 92px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   14. Diversos
   -------------------------------------------------------------------------- */
.empty { text-align: center; padding: 44px 20px; }
.empty__icon {
  width: 54px; height: 54px; border-radius: var(--r-lg); margin: 0 auto 14px;
  display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted);
}
.empty__icon svg { width: 24px; height: 24px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); }
.timeline__item { position: relative; padding-bottom: 16px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute; left: -22px; top: 4px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--brand-500);
}
.timeline__dot.is-success { border-color: var(--success-500); }
.timeline__dot.is-warning { border-color: var(--warning-500); }
.timeline__dot.is-danger { border-color: var(--danger-500); }
.timeline__dot.is-muted { border-color: var(--border-strong); }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-plain > li:last-child { border-bottom: 0; }

.rank-num {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: var(--r-xs);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-secondary);
}
.rank-num.is-top { background: var(--brand-500); color: #fff; }

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 13, 25, .5);
  backdrop-filter: blur(2px); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--surface); z-index: 91; box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform .25s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head { padding: 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 18px; }
.drawer__foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

.sticky-bar {
  position: sticky; bottom: 0; z-index: 40;
  margin: 24px -24px -24px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}

.tag-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

.preview-frame {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); overflow: hidden;
}
.preview-frame__bar {
  height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  background: var(--surface-3); border-bottom: 1px solid var(--border);
}
.preview-frame__bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); display: block; }

.kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-secondary);
  border-radius: var(--r-xs); padding: 2px 6px; border: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   15. Responsivo
   -------------------------------------------------------------------------- */
@media (max-width: 1400px) {
  .grid--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .grid--5, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--sidebar, .grid--main-aside { grid-template-columns: minmax(0, 1fr); }
  .audience-summary { position: static; }
  .eng-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* A sidebar vira gaveta: sai da esquerda por cima do conteúdo, com véu, e
   fecha pelo X, pelo véu, pelo Esc ou ao navegar (js/ui/shell.js).
   Fechada ela também sai da ordem de foco — só o transform deixaria os links
   navegáveis pelo teclado fora da tela. A largura é menor que a viewport de
   propósito: a faixa de véu à direita é o que sugere "toque fora para fechar". */
@media (max-width: 980px) {
  .sidebar {
    --sidebar-panel-w: min(300px, calc(100vw - 64px));
    width: var(--sidebar-panel-w);
    /* Respeita notch / home indicator para o rodapé com os ⋮ não sumir. */
    top: max(var(--sidebar-gap), env(safe-area-inset-top, 0px));
    bottom: max(var(--sidebar-gap), env(safe-area-inset-bottom, 0px));
    max-height: none;
    visibility: hidden;
    transform: translateX(calc(-100% - var(--sidebar-gap) * 2));
    transition: transform .26s var(--ease), visibility .26s var(--ease);
  }
  .sidebar.is-open { visibility: visible; transform: translateX(0); }
  .sidebar__scroll { overscroll-behavior: contain; }
  .sidebar__collapse { display: none; }
  .sidebar__close { display: grid; }
  .nav-backdrop { display: block; }
  body.is-nav-open { overflow: hidden; }
  .topbar__menu { display: grid; }
  .main { margin-left: 0; }
  .grid--3, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .mode-cards { grid-template-columns: minmax(0, 1fr); }
  .topbar__search { flex-basis: 200px; }
  /* Garante que o ícone ⋮ do usuário nunca seja comprimido na gaveta. */
  .side-user > svg,
  .side-user > [data-icon] { flex: 0 0 15px; }
}
@media (max-width: 720px) {
  .content { padding: 16px; }
  .grid--6, .grid--5, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eng-grid { grid-template-columns: minmax(0, 1fr); }
  .stat__value { font-size: 22px; }
  .sticky-bar { margin: 16px -16px -16px; padding: 12px 16px; }
  /* Espaço da topbar é para o menu e a busca; atalho de teclado sai. */
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar__search { flex: 1 1 auto; max-width: none; }
  .topbar__search kbd { display: none; }
}

/* --------------------------------------------------------------------------
   16. Autenticação (login, recuperação de senha, 2FA)
   Texto mínimo; o interesse visual vem do fundo animado, do card em vidro
   e das micro-interações dos campos.
   -------------------------------------------------------------------------- */
.auth {
  --auth-dot: rgba(20, 18, 31, .13);
  --auth-glass: rgba(255, 255, 255, .74);
  --auth-hairline: rgba(255, 255, 255, .95);
  /* Verde da marca no orbe dominante, ciano para contraste frio e um verde
     profundo atrás do card para dar profundidade. */
  --auth-orb-1: rgba(38, 163, 109, .28);
  --auth-orb-2: rgba(14, 165, 233, .18);
  --auth-orb-3: rgba(20, 107, 70, .18);

  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: var(--bg);
  overflow: hidden;
}
[data-theme="dark"] .auth {
  --auth-dot: rgba(255, 255, 255, .1);
  --auth-glass: rgba(23, 22, 31, .62);
  --auth-hairline: rgba(255, 255, 255, .14);
  --auth-orb-1: rgba(52, 185, 126, .3);
  --auth-orb-2: rgba(14, 165, 233, .18);
  --auth-orb-3: rgba(111, 207, 161, .16);
}

/* ------- Fundo: orbes em deriva + malha de pontos -------
   Os orbes ficam contidos numa área central por máscara radial, para que
   as bordas da tela permaneçam limpas. */
.auth__bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: radial-gradient(46% 46% at 50% 48%, #000 30%, transparent 78%);
  mask-image: radial-gradient(46% 46% at 50% 48%, #000 30%, transparent 78%);
}
.auth__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  will-change: transform;
}
.auth__orb--1 {
  width: 24vw; height: 24vw; top: 14%; left: 22%;
  background: var(--auth-orb-1);
  animation: orb-a 26s var(--ease) infinite alternate;
}
.auth__orb--2 {
  width: 20vw; height: 20vw; bottom: 12%; right: 24%;
  background: var(--auth-orb-2);
  animation: orb-b 32s var(--ease) infinite alternate;
}
.auth__orb--3 {
  width: 15vw; height: 15vw; top: 52%; left: 56%;
  background: var(--auth-orb-3);
  animation: orb-c 22s var(--ease) infinite alternate;
}
@keyframes orb-a { to { transform: translate3d(7vw, 6vh, 0) scale(1.16); } }
@keyframes orb-b { to { transform: translate3d(-6vw, -5vh, 0) scale(1.1); } }
@keyframes orb-c { to { transform: translate3d(-5vw, 7vh, 0) scale(.84); } }

/* Malha de pontos com desvanecimento radial ao redor do card. */
.auth__mesh {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--auth-dot) 1px, transparent 1px);
  background-size: 24px 24px;
}

.auth__tools { position: fixed; top: 18px; right: 20px; display: flex; gap: 8px; z-index: 3; }

/* ------- Coluna central ------- */
.auth-box {
  position: relative; z-index: 2;
  width: 100%; max-width: 396px;
  animation: auth-rise .55s var(--ease) both;
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* ------- Marca oficial com anel girando ------- */
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 20px; }
.auth-mark { position: relative; width: 46px; height: 46px; flex: 0 0 46px; }
/* Aro fino que acompanha o raio do tile: o gradiente cônico gira dentro de
   uma máscara em anel, evitando o borrão de um gradiente sólido. */
.auth-mark__ring {
  position: absolute; inset: -4px;
  border-radius: 17px; padding: 2px;
  background: conic-gradient(from 0deg, transparent 0 52%, var(--brand-300) 74%, var(--brand-400) 88%, transparent 97%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: spin 4.5s linear infinite;
}
.auth-mark__face {
  position: absolute; inset: 0;
  border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-500) 58%, var(--brand-700));
  box-shadow: 0 6px 20px rgba(38, 163, 109, .45), inset 0 1px 0 rgba(255, 255, 255, .28);
}
/* O pássaro entra em branco e levemente rotacionado, ganhando movimento
   junto ao anel sem descaracterizar a marca. */
.auth-mark__logo {
  width: 58%; height: 58%; color: #fff;
  filter: drop-shadow(0 1px 2px rgba(9, 60, 39, .35));
  animation: mark-in .7s var(--ease) both;
}
.auth-mark__logo svg { width: 100%; height: 100%; display: block; }
@keyframes mark-in {
  from { opacity: 0; transform: rotate(-14deg) scale(.82); }
  to { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-brand__name { font-size: 15.5px; font-weight: 660; letter-spacing: -.015em; color: var(--text); }
.auth-brand__name b { font-weight: 760; color: var(--brand-600); }
[data-theme="dark"] .auth-brand__name b { color: var(--brand-300); }

/* ------- Card em vidro com fio de luz na borda ------- */
.auth-panel {
  position: relative;
  padding: 26px;
  border-radius: var(--r-xl);
  background: var(--auth-glass);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  box-shadow: var(--shadow-lg);
}
/* Fio de 1px em degradê, desenhado por máscara para não virar borda chapada. */
.auth-panel::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(150deg, var(--auth-hairline), rgba(38, 163, 109, .4) 42%, transparent 78%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
/* Foco de luz que acompanha o cursor. */
.auth-panel::after {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), rgba(38, 163, 109, .12), transparent 68%);
  opacity: 0; transition: opacity .35s var(--ease);
}
.auth-panel:hover::after { opacity: 1; }

.auth-panel h1 { font-size: 21px; letter-spacing: -.025em; }
.auth-panel__sub { margin-top: 5px; color: var(--text-secondary); font-size: 13px; }

/* ------- Alternador com indicador deslizante ------- */
.auth-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 3px; margin-bottom: 20px;
  background: var(--surface-3); border-radius: var(--r-full);
}
.auth-tabs__ind {
  position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px); border-radius: var(--r-full);
  background: var(--surface); box-shadow: var(--shadow-xs);
  transition: transform .3s var(--ease);
}
.auth-tabs[data-active="forgot"] .auth-tabs__ind { transform: translateX(100%); }
.auth-tabs button {
  position: relative; z-index: 1;
  border: 0; background: transparent; cursor: pointer;
  height: 32px; border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 580; color: var(--text-secondary);
  transition: color .2s var(--ease);
}
.auth-tabs button.is-active { color: var(--text); font-weight: 640; }

/* ------- Campos com rótulo flutuante ------- */
.auth-form > * { animation: auth-rise .45s var(--ease) both; }
.auth-form > *:nth-child(1) { animation-delay: .05s; }
.auth-form > *:nth-child(2) { animation-delay: .1s; }
.auth-form > *:nth-child(3) { animation-delay: .15s; }
.auth-form > *:nth-child(4) { animation-delay: .2s; }

.ffield { position: relative; margin-bottom: 11px; }
.ffield__input {
  width: 100%; height: 54px;
  padding: 19px 14px 5px 42px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.ffield--btn .ffield__input { padding-right: 44px; }
.ffield__input:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--focus-ring); }

.ffield__label {
  position: absolute; left: 42px; top: 17px;
  font-size: 14px; color: var(--text-muted);
  pointer-events: none; transform-origin: left top;
  transition: transform .18s var(--ease), color .18s var(--ease);
}
.ffield__input:focus ~ .ffield__label,
.ffield__input:not(:placeholder-shown) ~ .ffield__label {
  transform: translateY(-11px) scale(.78);
  color: var(--text-secondary);
}
.ffield__input:focus ~ .ffield__label { color: var(--brand-500); }

.ffield__ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); transition: color .18s var(--ease);
}
.ffield__ico svg { width: 17px; height: 17px; }
.ffield__input:focus ~ .ffield__ico { color: var(--brand-500); }

.ffield__btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: var(--r-xs);
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--text-muted);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.ffield__btn:hover { background: var(--surface-3); color: var(--text); }
.ffield__btn svg { width: 16px; height: 16px; }

/* Aviso de Caps Lock — aparece só quando a tecla está ativa. */
.ffield__caps {
  position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: var(--warning-600); background: var(--warning-50);
  padding: 3px 7px; border-radius: var(--r-full);
}
.ffield__caps svg { width: 11px; height: 11px; }
.ffield.is-caps .ffield__caps { display: flex; }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 16px; }
.auth-row a { font-size: 12.5px; font-weight: 560; }

/* ------- Botão com brilho de passagem e estados ------- */
.btn--sheen { position: relative; overflow: hidden; }
.btn--sheen::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .34) 46%, transparent 62%);
  transform: translateX(-130%);
  transition: transform .75s var(--ease);
}
.btn--sheen:hover::after { transform: translateX(130%); }
.btn--sheen > * { position: relative; z-index: 1; }

.btn__spin {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .34); border-top-color: #fff;
  animation: spin .7s linear infinite;
  display: none;
}
.btn.is-loading .btn__spin { display: block; }
.btn.is-loading .btn__txt { display: none; }
.btn.is-loading { pointer-events: none; }
.btn.is-done { background: var(--success-500); }

/* ------- Dashboard skeleton (async load) ------- */
.skel {
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: skel-shine 1.2s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.skel--line { height: 12px; width: 100%; }
.skel--value { height: 28px; width: 48%; }
.skel--block { width: 100%; min-height: 120px; }
.skel--circle { border-radius: 50%; }
.skeleton-card { pointer-events: none; }
#dashboard.is-loading .card__body,
#deliverability.is-loading .card__body { opacity: .92; }
@keyframes skel-shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ------- Código de verificação ------- */
.otp { display: flex; gap: 8px; }
.otp input {
  flex: 1 1 0; min-width: 0; height: 54px; padding: 0;
  text-align: center; font-size: 20px; font-weight: 680;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.otp input:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--focus-ring); transform: translateY(-2px); }
.otp input.is-filled { border-color: var(--brand-300); background: var(--brand-50); }

.auth-foot { margin-top: 16px; font-size: 12px; color: var(--text-muted); text-align: center; }
.auth-foot a { color: var(--text-secondary); font-weight: 560; }

.auth-back {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: transparent; cursor: pointer; padding: 0;
  font-size: 12px; font-weight: 560; color: var(--text-secondary);
  font-family: inherit;
}
.auth-back:hover { color: var(--text); }
.auth-back svg { width: 13px; height: 13px; }

@media (max-width: 520px) {
  .auth { padding: 24px 16px; }
  .auth-panel { padding: 22px 18px; }
  .auth__orb--1, .auth__orb--2, .auth__orb--3 { width: 70vw; height: 70vw; }
}

/* Respeita quem prefere menos movimento. */
@media (prefers-reduced-motion: reduce) {
  .auth__orb, .auth-mark__ring, .auth-box, .auth-form > *, .btn__spin,
  .ws__logo-ring, .ws__logo-svg { animation: none !important; }
  .btn--sheen::after { display: none; }
}

/* Comparação executiva */
.compare-letter {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 7px;
  font-size: 11px; font-weight: 750; letter-spacing: .02em;
  flex: 0 0 22px;
}
.compare-letter.is-a { background: color-mix(in srgb, var(--brand-500) 18%, transparent); color: var(--brand-600); }
.compare-letter.is-b { background: color-mix(in srgb, var(--info-500) 18%, transparent); color: var(--info-600); }

.compare-picker > .card__body { padding: 16px 18px 18px; }
.compare-picker__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.compare-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 14px 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.compare-pick:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, transparent);
}
.compare-pick__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.compare-pick__head .compare-letter {
  width: 28px; height: 28px; border-radius: 9px;
  font-size: 12px;
  background: var(--surface-3);
  color: var(--text-secondary);
}
.compare-pick__label {
  display: block;
  margin: 0;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.compare-pick__hint {
  display: block;
  margin-top: 2px;
  font-size: 11px; font-weight: 550;
  color: var(--text-muted);
}
.compare-pick__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.compare-pick__search {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.compare-pick__search > i,
.compare-pick__search > [data-icon] {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}
.compare-pick__search svg { width: 14px; height: 14px; }
.compare-pick__search .input,
.compare-pick .select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--surface);
}
.compare-pick__search .input {
  padding-left: 34px;
}
.compare-pick .select {
  font-weight: 550;
}
.compare-pick__vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100%;
}
.compare-pick__rule {
  flex: 1 1 auto;
  width: 1px;
  min-height: 18px;
  background: var(--border-strong);
  opacity: .55;
}
.compare-pick__vs-label {
  font-size: 10px; font-weight: 750;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.compare-pick__swap {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.compare-pick__swap svg { width: 16px; height: 16px; }
.compare-pick__swap:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-md);
  transform: rotate(180deg);
}
.compare-pick__swap:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.compare-verdict { margin-bottom: 20px; }
.compare-verdict__card {
  padding: 22px 24px;
  border-radius: var(--r-md);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-500) 10%, var(--surface)), var(--surface) 55%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--brand-500) 22%, var(--border));
}
.compare-verdict__card.is-tie {
  background: var(--surface-2);
  border-color: var(--border);
}
.compare-verdict__eyebrow {
  font-size: 11px; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-600); margin-bottom: 8px;
}
.compare-verdict__title {
  font-size: 22px; font-weight: 750; letter-spacing: -.025em; line-height: 1.25;
  max-width: 46rem;
}
.compare-verdict__meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 12px; font-size: 13px; color: var(--text-secondary);
}
.compare-verdict__meta b { color: var(--text); font-weight: 680; }

.compare-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.compare-matchup__side {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  border-top: 3px solid var(--border);
}
.compare-matchup__side:first-child { border-top-color: var(--brand-500); }
.compare-matchup__side:last-child { border-top-color: var(--info-500); }
.compare-matchup__side.is-leader {
  background: color-mix(in srgb, var(--brand-500) 5%, var(--surface));
  box-shadow: var(--shadow-xs);
}
.compare-matchup__tag {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.compare-matchup__name {
  font-size: 17px; font-weight: 720; letter-spacing: -.02em; line-height: 1.25;
}
.compare-matchup__subject {
  margin-top: 4px; color: var(--text-muted); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.compare-matchup__meta {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  margin: 12px 0; font-size: 12.5px; color: var(--text-secondary);
}
.compare-matchup__vs {
  display: grid; place-items: center;
  font-size: 11px; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted);
}

.compare-kpi--exec { padding: 16px 18px; }
.compare-kpi--exec .stat__label {
  font-size: 12px; font-weight: 650; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px;
}
.compare-kpi__duo {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.compare-kpi__duo > div {
  display: flex; align-items: center; gap: 7px;
  font-size: 22px; font-weight: 750; letter-spacing: -.03em;
}
.compare-kpi--exec .stat__foot {
  margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.compare-scorecard th { white-space: nowrap; }
.compare-scorecard td { padding-top: 12px; padding-bottom: 12px; font-size: 13.5px; }
.compare-scorecard tr.is-key td { background: color-mix(in srgb, var(--brand-500) 5%, transparent); }
.compare-lead {
  display: inline-grid; place-items: center;
  min-width: 28px; height: 22px; padding: 0 7px;
  border-radius: 6px; font-size: 11px; font-weight: 750;
  background: var(--surface-3); color: var(--text-muted);
}
.compare-lead.is-a { background: color-mix(in srgb, var(--brand-500) 16%, transparent); color: var(--brand-600); }
.compare-lead.is-b { background: color-mix(in srgb, var(--info-500) 16%, transparent); color: var(--info-600); }

.compare-conv-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.compare-conv-chip {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.compare-conv-chip .is-a { color: var(--brand-600); font-weight: 700; margin-right: 2px; }
.compare-conv-chip .is-b { color: var(--info-600); font-weight: 700; margin-right: 2px; }

.compare-deliv__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.compare-link {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.compare-link:last-child { border-bottom: 0; }

.compare-result.is-entering .compare-verdict__card,
.compare-result.is-entering .compare-matchup,
.compare-result.is-entering .stat,
.compare-result.is-entering .card {
  animation: compareIn .4s var(--ease) both;
}
.compare-result.is-entering .stat:nth-child(2) { animation-delay: .04s; }
.compare-result.is-entering .stat:nth-child(3) { animation-delay: .08s; }
.compare-result.is-entering .stat:nth-child(4) { animation-delay: .12s; }

@keyframes compareIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .compare-picker__grid,
  .compare-matchup { grid-template-columns: minmax(0, 1fr); }
  .compare-pick__vs {
    flex-direction: row;
    min-height: 0;
    padding: 2px 0;
    gap: 10px;
  }
  .compare-pick__rule {
    width: auto;
    height: 1px;
    min-height: 0;
    flex: 1 1 auto;
  }
  .compare-conv-strip { grid-template-columns: minmax(0, 1fr); }
  .compare-verdict__title { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .compare-result.is-entering .compare-verdict__card,
  .compare-result.is-entering .compare-matchup,
  .compare-result.is-entering .stat,
  .compare-result.is-entering .card { animation: none !important; }
}

/* ---------------- Relatórios: intervalo de datas nos filtros ---------------- */
.report-dates {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.report-dates:focus-within {
  border-color: var(--brand-400);
  box-shadow: var(--focus-ring);
}
.report-dates.is-custom {
  border-color: var(--brand-300);
  background: var(--brand-50);
}
.report-dates__field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 10px;
  min-width: 0;
  cursor: pointer;
}
.report-dates__label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}
.report-dates__input.input {
  width: auto;
  min-width: 132px;
  height: 36px;
  margin: 0;
  padding: 0 2px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.report-dates__input.input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}
.report-dates__sep {
  display: grid;
  place-items: center;
  width: 22px;
  flex: 0 0 22px;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  user-select: none;
}
.report-dates.is-custom .report-dates__sep {
  background: color-mix(in srgb, var(--brand-100) 70%, var(--surface));
  border-color: var(--brand-200);
}

@media (max-width: 720px) {
  .report-dates {
    width: 100%;
    height: auto;
    flex-direction: column;
  }
  .report-dates__field {
    padding: 6px 10px;
  }
  .report-dates__input.input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }
  .report-dates__sep {
    width: 100%;
    height: 1px;
    border: 0;
    border-top: 1px solid var(--border);
    background: transparent;
    color: transparent;
    font-size: 0;
  }
}

/* Inbox do sino — lifecycle notifications */
#notif-bell { position: relative; }
.dropdown-menu.notif-menu {
  width: min(380px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 0 !important;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  right: 0;
  left: auto;
  box-sizing: border-box;
}
.notif-menu__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.notif-menu__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  min-width: 0;
}
.notif-menu__actions {
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.notif-menu__action {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-600);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  padding: 4px 0;
  line-height: 1.2;
  white-space: nowrap;
}
.notif-menu__action:hover { color: var(--brand-700); text-decoration: underline; }
.notif-menu__action--muted { color: var(--text-muted); }
.notif-menu__action--muted:hover { color: var(--danger-600, #dc2626); }
.notif-menu__list {
  max-height: min(440px, 62vh);
  overflow: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.notif-section {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.notif-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.notif-item {
  position: relative;
  display: flex;
  align-items: stretch;
  margin: 0;
  background: transparent;
  transition: background .12s var(--ease);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { background: var(--brand-50); }
.notif-item.is-unread:hover { background: color-mix(in srgb, var(--brand-500) 10%, var(--surface-2)); }
[data-theme="dark"] .notif-item.is-unread {
  background: color-mix(in srgb, var(--brand-500) 12%, var(--surface));
}
a.notif-item__link {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  padding: 12px 40px 12px 16px;
  margin: 0;
  color: var(--text) !important;
  text-decoration: none !important;
  background: transparent;
  border: 0;
  white-space: normal !important;
  line-height: 1.35;
}
a.notif-item__link:hover,
a.notif-item__link:focus {
  color: var(--text) !important;
  text-decoration: none !important;
  background: transparent !important;
}
.notif-item__dismiss {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: .55;
  transition: opacity .12s var(--ease), background .12s var(--ease), color .12s var(--ease);
}
.notif-item:hover .notif-item__dismiss,
.notif-item__dismiss:focus {
  opacity: 1;
}
.notif-item__dismiss:hover {
  background: var(--surface-3);
  color: var(--danger-600, #dc2626);
}
.notif-item__dismiss svg { width: 14px; height: 14px; }
.notif-item__rail {
  width: 10px;
  flex: 0 0 10px;
  display: flex;
  justify-content: center;
  padding-top: 5px;
}
.notif-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.notif-item__dot--warning {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}
.notif-item__dot--success { background: var(--success-500); }
.notif-item__dot--muted { background: var(--text-muted); }
.notif-item__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.notif-item__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.notif-item__title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.notif-item__time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  margin-top: 2px;
}
.notif-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.notif-item__label {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--surface-3);
  color: var(--text-secondary);
}
.notif-item__label--warning {
  background: rgba(245, 158, 11, .14);
  color: #b45309;
}
.notif-item__label--success {
  background: color-mix(in srgb, var(--success-500) 14%, var(--surface));
  color: var(--success-600, #15803d);
}
.notif-item__label--muted {
  background: var(--surface-3);
  color: var(--text-muted);
}
.notif-item__progress {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.notif-item__bar {
  display: block;
  height: 4px;
  margin-top: 2px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.notif-item__bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: #f59e0b;
}
.notif-menu__foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: var(--surface);
}
.notif-menu__foot a {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary) !important;
  text-decoration: none !important;
  white-space: normal !important;
  line-height: 1.35;
}
.notif-menu__foot a:hover { color: var(--brand-600) !important; }

/* Diálogo global (AF.alert / AF.confirm) */
.af-dialog {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.af-dialog[hidden] { display: none !important; }
.af-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
}
.af-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(80dvh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop, 0 24px 48px rgba(0,0,0,.18));
  overflow: hidden;
}
.af-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}
.af-dialog__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.af-dialog__close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.af-dialog__close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.af-dialog__close svg { width: 16px; height: 16px; }
.af-dialog__body {
  padding: 12px 16px 8px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  overflow: auto;
  min-height: 0;
}
.af-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px 16px;
}
.af-dialog.is-danger .af-dialog__foot .btn--primary {
  background: var(--danger-600, #dc2626);
  border-color: var(--danger-600, #dc2626);
  color: #fff;
}
.af-dialog.is-danger .af-dialog__foot .btn--primary:hover {
  filter: brightness(.95);
}
body.is-dialog-open { overflow: hidden; }

@media (max-width: 520px) {
  .af-dialog__foot {
    flex-direction: column-reverse;
  }
  .af-dialog__foot .btn { width: 100%; }
}

/* Tablet: evita o painel escapar da viewport à esquerda */
@media (max-width: 980px) {
  .dropdown-menu.notif-menu {
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }
}

/* Mobile: painel full-width sob a topbar (sheet) */
@media (max-width: 720px) {
  .dropdown-menu.notif-menu {
    position: fixed;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 6px);
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    width: auto;
    max-width: none;
    margin: 0;
    max-height: calc(
      100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px
    );
    z-index: 1200;
    display: none;
    flex-direction: column;
  }
  #notif-bell.open > .dropdown-menu.notif-menu {
    display: flex;
  }
  .notif-menu__head {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
  }
  .notif-menu__actions {
    justify-content: flex-start;
    gap: 14px;
  }
  .notif-menu__list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }
  .notif-menu__foot {
    flex: 0 0 auto;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .notif-section { padding: 10px 14px 4px; }
  a.notif-item__link { padding: 12px 44px 12px 14px; }
  .notif-item__dismiss {
    opacity: 1;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
  }
  .notif-item__title { font-size: 13px; }
  .notif-item__row {
    flex-wrap: wrap;
    gap: 4px 10px;
  }
  .notif-item__time {
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .notif-menu__action { font-size: 11.5px; }
  .notif-menu__title { font-size: 13.5px; }
}

