/* ============================================================
   Pushfy 2.0 — Design System "Vibrant Enterprise" (compacto)
   Direção: cor por canal + acentos vibrantes (gradientes sutis)
   com sobriedade, contraste AA e densidade compacta.
   Tudo via tokens (troca de tema/direção barata). Só /v2/.
   ============================================================ */

/* ---------- Tokens base ---------- */
:root {
  --sidebar-w: 236px;
  --topbar-h: 56px;

  /* espaçamento (escala 4/8, compacto) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 28px; --sp-7: 40px;

  /* raio */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  /* tipografia */
  --font-sans: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-display: 1.7rem; --fs-h1: 1.35rem; --fs-h2: 1.05rem;
  --fs-body: .875rem; --fs-sm: .8rem; --fs-xs: .7rem;

  /* acentos e semânticos (hue fixo, variantes por tema) */
  --accent: #4979FF; --accent-2: #6f9bff;
  --grad-brand: linear-gradient(135deg, #4979FF 0%, #6f9bff 100%);
  --grad-accent: linear-gradient(135deg, #4979FF 0%, #6f9bff 100%);

  /* canais */
  --ch-sms: #4979FF; --ch-rcs: #f59e0b; --ch-voz: #0ea5e9; --ch-whatsapp: #16a34a; --ch-email: #db2777;

  /* motion */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 120ms; --t: 200ms; --t-slow: 320ms;
}

[data-bs-theme="light"] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e6e8f0;
  --text: #171a23;
  --muted: #6b7280;
  --accent-weak: rgba(73, 121, 255, .10);
  --success: #4979FF; --success-weak: rgba(73, 121, 255, .12);
  --warning: #d9870a; --warning-weak: rgba(217, 135, 10, .14);
  --danger: #e0383b;  --danger-weak: rgba(224, 56, 59, .12);
  --info: #0ea5e9;    --info-weak: rgba(14, 165, 233, .12);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-lg: 0 18px 40px rgba(16, 24, 40, .14);
}

[data-bs-theme="dark"] {
  --bg: #090b11;
  --surface: #11141d;
  --surface-2: #181d29;
  --border: #232838;
  --text: #e7e9f1;
  --muted: #98a0b3;
  --accent-weak: rgba(73, 121, 255, .16);
  --success: #5e8bff; --success-weak: rgba(73, 121, 255, .16);
  --warning: #e7a33a; --warning-weak: rgba(231, 163, 58, .16);
  --danger: #ef5557;  --danger-weak: rgba(239, 85, 87, .16);
  --info: #38b6f0;    --info-weak: rgba(56, 182, 240, .16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .55);
}

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-pill); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}

/* ---------- Shell ---------- */
.v2-shell { display: flex; min-height: 100vh; }

/* Sidebar (escura nos dois temas — identidade premium) */
.v2-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0e1119 0%, #0a0c12 100%);
  color: #aeb4c4;
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, .05);
  transition: transform var(--t) var(--ease);
}
.v2-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; font-weight: 700; color: #fff; }
.v2-brand-text { font-size: .98rem; letter-spacing: -.02em; }
.v2-brand-text small { opacity: .55; font-weight: 600; }
.v2-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--grad-brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(73, 121, 255, .45);
}
.v2-nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px; flex: 1; overflow-y: auto; }
.v2-nav-group { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .32); padding: 14px 10px 4px; font-weight: 700; }
.v2-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 11px; border-radius: var(--r-sm);
  color: #aeb4c4; text-decoration: none; font-size: .86rem; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.v2-nav-item i { font-size: 1.02rem; opacity: .85; width: 18px; text-align: center; }
.v2-nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.v2-nav-item.active { background: rgba(73, 121, 255, .16); color: #fff; }
.v2-nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: var(--r-pill); background: var(--grad-brand);
}
.v2-nav-item.active i { opacity: 1; color: #a9c2ff; }
.v2-sidebar-foot { padding: 8px 10px; border-top: 1px solid rgba(255, 255, 255, .06); }

/* ---------- Main / topbar ---------- */
.v2-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.v2-topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 var(--sp-5); background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1030;
}
.v2-topbar-spacer { flex: 1; }
.v2-burger { display: none; border: 1px solid var(--border); color: var(--text); background: transparent; border-radius: var(--r-sm); }
.v2-theme-toggle, .v2-user { border: 1px solid var(--border); color: var(--text); background: var(--surface); border-radius: var(--r-sm); transition: background var(--t-fast); }
.v2-theme-toggle:hover, .v2-user:hover { background: var(--surface-2); }
.v2-user { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; }
.v2-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .76rem; }
.v2-search { align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 5px 12px; min-width: 280px; transition: border-color var(--t-fast); }
.v2-search:focus-within { border-color: var(--accent); }
.v2-search i { color: var(--muted); }
.v2-search input { border: 0; background: transparent; outline: none; color: var(--text); width: 100%; font-size: .85rem; }
.v2-content { padding: var(--sp-5); width: 100%; }

/* ---------- Page head ---------- */
.v2-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: var(--sp-4); flex-wrap: wrap; }
.v2-page-title { font-size: var(--fs-h1); font-weight: 700; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.v2-page-sub { color: var(--muted); margin: 3px 0 0; font-size: .85rem; }
.v2-fresh { font-size: .74rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 5px 11px; border-radius: var(--r-pill); white-space: nowrap; }
.v2-section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 4px 0 10px; }

/* ---------- Cards ---------- */
.v2-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t), border-color var(--t); }
.v2-card--block { display: block; }
/* PushAgent e páginas que combinam .card do Bootstrap com .v2-card: o Bootstrap
   .card já é coluna full-width; anulamos o flex-row do .v2-card p/ o conteúdo
   (card-body, .row, tabelas) ocupar 100% da largura. */
.card.v2-card { display: block; width: 100%; }
.card.v2-card > .card-body { width: 100%; }
.v2-card-body { flex: 1; min-width: 0; }
.v2-card-icon { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.v2-card-label { color: var(--muted); font-size: .78rem; font-weight: 500; }
.v2-card-value { font-size: 1.45rem; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.v2-card-hint { color: var(--muted); font-size: .72rem; }
a.v2-card, .v2-card[role="button"] { cursor: pointer; }
a.v2-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

/* ---------- KPI ---------- */
.v2-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); height: 100%; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.v2-kpi-label { color: var(--muted); font-size: .76rem; font-weight: 500; }
.v2-kpi-value { font-size: 1.55rem; font-weight: 750; line-height: 1.35; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.v2-kpi-foot { color: var(--muted); font-size: .72rem; }
/* KPI herói (variante de destaque) */
.v2-kpi--hero { background: linear-gradient(135deg, var(--accent-weak), transparent 70%); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.v2-kpi--hero .v2-kpi-value { font-size: 2rem; }

/* ---------- Login ---------- */
.v2-login-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, rgba(73, 121, 255, .25), transparent), linear-gradient(135deg, #0d1019, #161a2b); padding: 20px; }
.v2-login-card { width: 100%; max-width: 380px; background: var(--surface, #fff); border-radius: var(--r-lg); padding: 30px; box-shadow: var(--shadow-lg); }
.v2-login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.v2-login-brand h1 { font-size: 1.35rem; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.v2-login-brand small { opacity: .5; }

/* ---------- Tabelas ---------- */
.v2-table { color: var(--text); font-size: .84rem; }
.v2-table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 700; padding: 10px 12px; background: var(--surface-2); }
.v2-table td { border-color: var(--border); padding: 9px 12px; vertical-align: middle; }
.v2-table tbody tr { transition: background var(--t-fast); }
.v2-table tbody tr:hover { background: var(--surface-2); }
.v2-table .progress { background: var(--surface-2); height: 6px !important; border-radius: var(--r-pill); }
.v2-table .progress-bar { background: var(--grad-accent); border-radius: var(--r-pill); }

/* ---------- Produtos: tabs + ícone ---------- */
.v2-tabs { gap: 4px; }
/* Subabas (2º nível, ex.: dentro da Configuração do PushAgent) — mais discretas */
.v2-subtabs .nav-link { font-size: .82rem; padding: 5px 12px; border-radius: var(--r-pill); color: var(--muted); background: transparent; border: 1px solid transparent; }
.v2-subtabs .nav-link:hover { background: var(--surface-2); color: var(--text); }
.v2-subtabs .nav-link.active { background: var(--accent-weak); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.v2-tabs .nav-link { color: var(--muted); border-radius: var(--r-sm); padding: 6px 14px; font-size: .85rem; font-weight: 600; transition: background var(--t-fast), color var(--t-fast); }
.v2-tabs .nav-link:hover { background: var(--surface-2); color: var(--text); }
.v2-tabs .nav-link.active { background: var(--grad-accent); color: #fff; box-shadow: 0 4px 12px rgba(73, 121, 255, .35); }
.v2-prod-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); font-size: 1rem; }

/* ---------- Componentes utilitários ---------- */
.v2-source-note { font-size: .74rem; color: var(--muted); }
.v2-code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; font-size: .8rem; overflow: auto; color: var(--text); font-family: var(--font-mono); }
.v2-chart-loading { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .82rem; min-height: 200px; }

/* Custo estimado — valores em R$ podem ser longos: fonte menor e sem quebra p/ caber. */
.v2-kpi.v2-kpi--cost .v2-kpi-value { font-size: 1.15rem; white-space: nowrap; }
.v2-kpi.v2-kpi--cost.v2-kpi--hero .v2-kpi-value { font-size: 1.4rem; }

/* Funil de entrega (dashboard) */
.v2-funnel { display: flex; flex-direction: column; gap: 16px; padding: 6px 2px; }
.v2-funnel-row { display: flex; flex-direction: column; gap: 6px; }
.v2-funnel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.v2-funnel-label { font-size: .82rem; font-weight: 600; color: var(--text); }
.v2-funnel-num { font-size: .82rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.v2-funnel-pct { font-size: .72rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.v2-funnel-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.v2-funnel-bar { height: 100%; border-radius: 999px; min-width: 2px; transition: width .5s ease; }

/* skeleton (base p/ D2) */
.v2-skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: v2shimmer 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes v2shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Bootstrap overrides (coesão) ---------- */
.btn { border-radius: var(--r-sm); font-size: .84rem; font-weight: 600; transition: filter var(--t-fast), background var(--t-fast); }
.btn-primary { background: var(--grad-accent); border: none; box-shadow: 0 4px 12px rgba(73, 121, 255, .3); }
.btn-primary:hover { filter: brightness(1.07); background: var(--grad-accent); }
.btn-outline-secondary { border-color: var(--border); color: var(--text); }
.btn-outline-secondary:hover, .btn-outline-secondary.active { background: var(--surface-2); border-color: var(--accent); color: var(--text); }
.btn-group .btn-outline-secondary.active { background: var(--accent-weak); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.form-control, .form-select { background: var(--surface); border-color: var(--border); color: var(--text); border-radius: var(--r-sm); font-size: .84rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); background: var(--surface); color: var(--text); }
.form-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.badge { border-radius: var(--r-sm); font-weight: 600; padding: .34em .6em; font-size: .72rem; }
.text-bg-success { background: var(--success-weak) !important; color: var(--success) !important; }
.text-bg-warning { background: var(--warning-weak) !important; color: var(--warning) !important; }
.text-bg-danger { background: var(--danger-weak) !important; color: var(--danger) !important; }
.text-bg-secondary { background: var(--surface-2) !important; color: var(--muted) !important; }
.text-bg-light { background: var(--surface-2) !important; color: var(--text) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.alert-light { background: var(--surface-2); border-color: var(--border); color: var(--text); border-radius: var(--r-md); }
.dropdown-menu { border-radius: var(--r-md); border-color: var(--border); box-shadow: var(--shadow-md); font-size: .85rem; background: var(--surface); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); }
.progress { background: var(--surface-2); }
.progress-bar { background: var(--grad-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Responsivo ---------- */
@media (max-width: 991.98px) {
  .v2-sidebar { transform: translateX(-100%); }
  .v2-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .v2-main { margin-left: 0; }
  .v2-burger { display: inline-flex; }
  .v2-search { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Logos ---------- */
.v2-brand { padding: 14px 16px 10px; }
.v2-brand a { display: block; line-height: 0; }
.v2-brand-img { height: 42px; width: auto; max-width: 200px; display: block; }
.v2-login-logo { height: 40px; width: auto; max-width: 230px; }

/* ---------- D2: count-up, toasts, empty states ---------- */
.v2-kpi-value.is-counting { color: var(--text); }
.v2-empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.v2-empty i { font-size: 1.8rem; opacity: .5; display: block; margin-bottom: 8px; }
.v2-empty-title { font-weight: 600; color: var(--text); font-size: .9rem; }
.v2-toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 1080; display: flex; flex-direction: column; gap: 8px; }
.v2-toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 11px 14px; font-size: .85rem; color: var(--text); min-width: 220px; max-width: 340px; display: flex; align-items: center; gap: 9px; animation: v2toastin var(--t) var(--ease); }
.v2-toast.ok { border-left-color: var(--success); }
.v2-toast.err { border-left-color: var(--danger); }
.v2-toast i { font-size: 1.05rem; }
.v2-toast.ok i { color: var(--success); }
.v2-toast.err i { color: var(--danger); }
@keyframes v2toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- D3: delta chip + sparkline ---------- */
.v2-delta { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: var(--r-pill); line-height: 1.6; }
.v2-delta.up { color: var(--success); background: var(--success-weak); }
.v2-delta.down { color: var(--danger); background: var(--danger-weak); }
.v2-delta.flat { color: var(--muted); background: var(--surface-2); }
.v2-kpi-spark { margin-top: 6px; height: 38px; }
.v2-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

/* ---------- D4: command palette, breadcrumb, densidade ---------- */
.v2-cmdk { position: fixed; inset: 0; z-index: 1090; background: rgba(8,10,16,.55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.v2-cmdk[hidden] { display: none; }
.v2-cmdk-box { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: v2toastin var(--t) var(--ease); }
.v2-cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.v2-cmdk-input i { color: var(--muted); font-size: 1.1rem; }
.v2-cmdk-input input { flex: 1; border: 0; background: transparent; outline: none; color: var(--text); font-size: 1rem; }
.v2-cmdk-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.v2-cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.v2-cmdk-item .l { flex: 1; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-cmdk-item .s { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.v2-cmdk-item i { color: var(--muted); width: 18px; text-align: center; }
.v2-cmdk-item.sel { background: var(--accent-weak); }
.v2-cmdk-item.sel i { color: var(--accent); }
.v2-cmdk-empty { padding: 22px; text-align: center; color: var(--muted); font-size: .85rem; }
.v2-cmdk-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: .72rem; }
.v2-kbd { display: inline-block; border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; font-size: .68rem; font-family: var(--font-mono); background: var(--surface-2); color: var(--muted); }
.dropdown-item .v2-kbd { float: right; margin-left: 10px; }

.v2-breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.v2-breadcrumb a { color: var(--muted); text-decoration: none; }
.v2-breadcrumb a:hover { color: var(--accent); }
.v2-bc-sep { opacity: .45; }
.v2-bc-cur { color: var(--text); font-weight: 600; }

/* Densidade confortável (override do compacto padrão) */
[data-density="comfortable"] { --topbar-h: 64px; }
[data-density="comfortable"] .v2-content { padding: 28px; }
[data-density="comfortable"] .v2-card, [data-density="comfortable"] .v2-kpi { padding: 20px; }
[data-density="comfortable"] .v2-table td { padding: 12px 14px; }
[data-density="comfortable"] .v2-table thead th { padding: 12px 14px; }
[data-density="comfortable"] .v2-nav-item { padding: 10px 12px; font-size: .9rem; }
[data-density="comfortable"] .v2-kpi-value { font-size: 1.7rem; }
[data-density="comfortable"] .v2-card-value { font-size: 1.6rem; }
[data-density="comfortable"] .v2-section-label { margin: 8px 0 14px; }

/* ---------- D5: motivos de falha ---------- */
.v2-motivos { display: flex; flex-direction: column; gap: 10px; }
.v2-motivo-top { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.v2-motivo-top .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.v2-motivo-top .l { flex: 1; color: var(--text); }
.v2-motivo-top .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.v2-motivo-bar { height: 6px; background: var(--surface-2); border-radius: var(--r-pill); margin-top: 4px; overflow: hidden; }
.v2-motivo-bar span { display: block; height: 100%; border-radius: var(--r-pill); }

/* ---------- Configurações: opções de tema ---------- */
.v2-theme-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.v2-theme-opt:hover { background: var(--surface-2); }
.v2-theme-opt.sel { border-color: var(--accent); background: var(--accent-weak); }
.v2-theme-opt input { accent-color: var(--accent); }
.v2-theme-opt i { font-size: 1.2rem; color: var(--accent); width: 22px; text-align: center; }

/* ============================================================
   UI Polish — telas de acesso, dashboard, navegação, geral (v=12)
   ============================================================ */

/* ---------- A) Telas de acesso: split-screen ---------- */
.v2-login-body { background:
  radial-gradient(1100px 600px at 16% -12%, rgba(73,121,255,.30), transparent),
  radial-gradient(900px 520px at 105% 112%, rgba(154,123,255,.24), transparent),
  linear-gradient(135deg, #0b0e17, #141829 60%, #0b0e17); }
.v2-auth { display: flex; width: 100%; max-width: 900px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: v2authin .55s var(--ease) both; }
@keyframes v2authin { from { opacity: 0; transform: translateY(16px) scale(.99); } to { opacity: 1; transform: none; } }
.v2-auth-aside { flex: 0 0 330px; position: relative; padding: 34px 30px; color: #fff; background: linear-gradient(155deg, #3f6dff, #6f9bff 55%, #9a7bff); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.v2-auth-aside::before, .v2-auth-aside::after { content: ""; position: absolute; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.9), transparent 70%); opacity: .28; }
.v2-auth-aside::before { width: 250px; height: 250px; top: -80px; right: -70px; animation: v2float 9s var(--ease) infinite alternate; }
.v2-auth-aside::after { width: 190px; height: 190px; bottom: -60px; left: -50px; opacity: .2; animation: v2float 12s var(--ease) infinite alternate-reverse; }
@keyframes v2float { from { transform: translate(0, 0); } to { transform: translate(14px, 18px); } }
.v2-auth-aside > * { position: relative; z-index: 1; }
.v2-auth-logo { height: 32px; width: auto; max-width: 170px; }
.v2-auth-tagline { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.22; margin: 0 0 10px; }
.v2-auth-sub { font-size: .85rem; opacity: .92; line-height: 1.5; margin: 0; }
.v2-auth-feats { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 11px; }
.v2-auth-feats li { display: flex; align-items: center; gap: 10px; font-size: .83rem; opacity: .96; }
.v2-auth-feats i { background: rgba(255,255,255,.18); width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; font-size: .85rem; flex: none; }
.v2-auth-foot { font-size: .72rem; opacity: .7; }
.v2-auth .v2-login-card { flex: 1; box-shadow: none; border-radius: 0; max-width: none; padding: 34px 38px; }
@media (max-width: 767.98px) { .v2-auth { display: block; max-width: 420px; } .v2-auth-aside { display: none; } .v2-auth .v2-login-card { padding: 30px; } }

/* ---------- B) Dashboard: KPI hover, reveal, skeleton ---------- */
.v2-kpi { transition: box-shadow var(--t), transform var(--t), border-color var(--t); }
.v2-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.v2-kpi::after { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: var(--grad-accent); opacity: 0; transition: opacity var(--t); }
.v2-kpi--hero::after { opacity: 1; }
.v2-kpi:hover::after { opacity: .55; }
.v2-card--block { transition: box-shadow var(--t), border-color var(--t); }
.v2-card--block:hover { box-shadow: var(--shadow-md); }

.v2-rise { opacity: 0; transform: translateY(12px); }
.v2-rise.v2-in { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }

/* skeleton shimmer durante o carregamento do gráfico (sem mexer no markup) */
.v2-chart-loading { color: transparent !important; position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.v2-chart-loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 10%, var(--border)) 50%, transparent); background-size: 200% 100%; animation: v2shimmer2 1.25s linear infinite; }
@keyframes v2shimmer2 { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- C) Sidebar: glow ativo, mini-perfil, colapsado ---------- */
.v2-nav-item.active { box-shadow: inset 0 0 0 1px rgba(73,121,255,.22), 0 4px 14px rgba(73,121,255,.12); }
.v2-sidebar-profile { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; min-width: 0; }
.v2-sidebar-profile .v2-avatar { width: 32px; height: 32px; flex: none; }
.v2-sidebar-profile .tx { min-width: 0; }
.v2-sidebar-profile .nm { font-size: .82rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-sidebar-profile .pl { font-size: .7rem; color: rgba(255,255,255,.5); white-space: nowrap; }
.v2-collapse-btn { width: 100%; margin-top: 6px; background: transparent; border: 1px solid rgba(255,255,255,.12); color: #aeb4c4; border-radius: var(--r-sm); font-size: .8rem; padding: 6px; transition: background var(--t-fast); }
.v2-collapse-btn:hover { background: rgba(255,255,255,.06); color: #fff; }

html.v2-collapsed .v2-shell { --sidebar-w: 74px; }
html.v2-collapsed .v2-nav-item span, html.v2-collapsed .v2-nav-group,
html.v2-collapsed .v2-sidebar-profile .tx, html.v2-collapsed .v2-collapse-btn span { display: none; }
html.v2-collapsed .v2-nav-item { justify-content: center; padding: 10px 0; }
html.v2-collapsed .v2-nav-item i { width: auto; font-size: 1.1rem; }
html.v2-collapsed .v2-brand { justify-content: center; padding: 14px 6px 10px; }
html.v2-collapsed .v2-brand-img { height: 30px; max-width: 44px; object-fit: contain; }
html.v2-collapsed .v2-sidebar-profile { justify-content: center; }
@media (max-width: 991.98px) { html.v2-collapsed .v2-shell { --sidebar-w: var(--sidebar-w); } }

/* ---------- C) Topbar: sino de avisos ---------- */
.v2-bell { position: relative; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r-sm); transition: background var(--t-fast); }
.v2-bell:hover { background: var(--surface-2); }
.v2-bell .dot { position: absolute; top: 4px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.v2-notif { width: 310px; max-width: 92vw; padding: 6px; }
.v2-notif h6 { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px 4px; margin: 0; }
.v2-notif-item { display: flex; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.v2-notif-item:hover { background: var(--surface-2); }
.v2-notif-item i { color: var(--accent); font-size: 1.05rem; margin-top: 1px; }
.v2-notif-item .t { font-size: .84rem; font-weight: 600; line-height: 1.2; }
.v2-notif-item .d { font-size: .74rem; color: var(--muted); }
.v2-notif-empty { padding: 18px; text-align: center; color: var(--muted); font-size: .82rem; }

/* ---------- D) Acabamento geral ---------- */
.v2-empty i { background: var(--accent-weak); color: var(--accent); width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; opacity: 1; font-size: 1.5rem; }
.v2-toast { backdrop-filter: blur(6px); }
[data-bs-theme="dark"] body { background:
  radial-gradient(900px 480px at 100% -8%, rgba(73,121,255,.07), transparent),
  radial-gradient(700px 420px at -5% 100%, rgba(154,123,255,.06), transparent),
  var(--bg); }
[data-bs-theme="dark"] .v2-kpi--hero { box-shadow: var(--shadow-sm), 0 0 36px -16px rgba(73,121,255,.5); }

/* Divisor "ou" (telas de acesso) */
.v2-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .78rem; }
.v2-or::before, .v2-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- E) Multi-empresa: seletor de empresa + faixa de impersonação ---------- */
.v2-org-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 230px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r-sm); padding: 6px 10px; transition: background var(--t-fast); }
.v2-org-btn:hover { background: var(--surface-2); }
.v2-org-btn i.bi-building { color: var(--accent); }
.v2-org-cur { font-weight: 600; font-size: .84rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Mobile (768-991): só o 1º nome do usuário, bem reduzido, p/ caber os outros elementos.
   O span é d-lg-none (não aparece no desktop >=992, que mantém o nome completo). */
.v2-user-first { font-size: .72rem; font-weight: 600; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Topbar no MOBILE (<992px): libera espaço p/ caber tudo. Desktop (>=992) intacto. */
@media (max-width: 991.98px) {
  .v2-org-cur { display: none; }          /* seletor de organização: só o ícone */
  .v2-user .badge { display: none; }      /* esconde o rótulo "sub-usuário" */
  .v2-user-first { max-width: 70px; }      /* 1º nome ainda mais enxuto no celular */
  .v2-topbar { gap: 4px; }
}
.v2-org-caret { font-size: .7rem; color: var(--muted); }
.v2-org-menu { width: 320px; max-width: 94vw; padding: 6px; }
.v2-org-menu h6 { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px 4px; margin: 0; }
.v2-org-back { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: var(--accent-weak); color: var(--accent); font-weight: 600; font-size: .82rem; padding: 9px 10px; border-radius: var(--r-sm); margin-bottom: 6px; cursor: pointer; }
.v2-org-search { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); margin: 2px 4px 8px; color: var(--muted); }
.v2-org-search input { border: 0; outline: 0; background: transparent; color: var(--text); width: 100%; font-size: .85rem; }
.v2-org-list { max-height: 320px; overflow-y: auto; }
.v2-org-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text); text-align: left; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.v2-org-item:hover { background: var(--surface-2); }
.v2-org-item.is-active { background: var(--accent-weak); cursor: default; }
.v2-org-item.is-loading { opacity: .5; pointer-events: none; }
.v2-org-av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: 0 0 auto; }
.v2-org-tx { min-width: 0; flex: 1; }
.v2-org-tx .nm { display: block; font-size: .85rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-org-tx .em { display: block; font-size: .73rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-org-item i.bi-check-lg { color: var(--accent); }
.v2-org-loading, .v2-org-empty { padding: 16px; text-align: center; color: var(--muted); font-size: .82rem; }
/* Item consolidado da organização (1º do dropdown) — destacado como visão executiva. */
.v2-org-consol { display: flex; align-items: center; gap: 10px; width: 100%; text-decoration: none; padding: 9px 10px; border-radius: var(--r-sm); margin-bottom: 6px; color: var(--text); background: linear-gradient(90deg, var(--accent-weak), transparent); border: 1px solid var(--border); }
.v2-org-consol:hover { background: var(--accent-weak); border-color: var(--accent); }
.v2-org-consol.is-active { background: var(--accent-weak); border-color: var(--accent); cursor: default; }
.v2-org-consol-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .9rem; flex: 0 0 auto; }
.v2-org-consol i.bi-check-lg { color: var(--accent); }
.v2-org-btn.is-org { border-color: var(--accent); }
.v2-org-btn.is-org i.bi-diagram-3-fill { color: var(--accent); }

.v2-impersonate { display: flex; align-items: center; gap: 10px; background: var(--accent-weak); border: 1px solid var(--accent); color: var(--text); border-radius: var(--r-sm); padding: 9px 14px; margin-bottom: 14px; font-size: .86rem; }
.v2-impersonate i.bi-eye { color: var(--accent); }
.v2-impersonate .v2-imp-id { color: var(--muted); font-size: .78rem; margin-left: 4px; }
.v2-impersonate .v2-org-reset { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent); font-weight: 600; font-size: .8rem; padding: 5px 10px; border-radius: var(--r-sm); cursor: pointer; }
.v2-impersonate .v2-org-reset:hover { background: var(--accent); color: #fff; }

/* ---------- Painel da Organização (visão consolidada) ---------- */
.text-accent { color: var(--accent) !important; }
.v2-org-cmp th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.v2-org-cmp th.sortable:hover { color: var(--accent); }
.v2-org-cmp th.sortable.asc::after { content: ' \2191'; color: var(--accent); }
.v2-org-cmp th.sortable.desc::after { content: ' \2193'; color: var(--accent); }
.v2-org-row { cursor: pointer; transition: background var(--t-fast), opacity var(--t-fast); }
.v2-org-row:hover { background: var(--surface-2); }
.v2-org-row.is-dim { opacity: .4; }
.v2-org-row.is-focus { background: var(--accent-weak); }
.v2-org-total td { border-top: 2px solid var(--border); background: var(--surface-2); }
.v2-org-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.v2-org-minibar { width: 120px; max-width: 40vw; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 3px; }
.v2-org-minibar span { display: block; height: 100%; border-radius: 3px; }
.v2-org-exp { border: 0; background: transparent; color: var(--muted); padding: 0 2px; cursor: pointer; line-height: 1; transition: transform var(--t-fast), color var(--t-fast); }
.v2-org-exp:hover { color: var(--accent); }
.v2-org-row.is-open .v2-org-exp { transform: rotate(90deg); color: var(--accent); }
.v2-org-detail { display: none; }
.v2-org-detail.open { display: table-row; }
.v2-org-detail > td { background: var(--surface-2); padding: 0; }
.v2-org-det { padding: 14px 16px; }
.v2-org-det-chs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.v2-org-det-ch { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); }
.v2-org-det-ch-hd { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .82rem; margin-bottom: 6px; }
.v2-org-det-bar { height: 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.v2-org-det-bar span { display: block; height: 100%; }
.v2-org-det-kv { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); padding: 1px 0; }
.v2-org-det-kv b { color: var(--text); font-weight: 600; }
.v2-org-det-deliv-lbl { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.v2-org-det-stack { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.v2-org-det-stack span { display: block; height: 100%; }
.v2-org-det-leg { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: .76rem; color: var(--muted); }
.v2-org-det-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Box destacado (enterprise): economia STRIKE desde o início da operação. */
.v2-strike-hero {
  display: flex; align-items: center; gap: 22px; padding: 30px 34px;
  border-radius: 20px; position: relative; overflow: hidden; isolation: isolate;
  color: #f0fdfa;
  background:
    radial-gradient(140% 180% at 92% -20%, rgba(45, 212, 191, .30) 0%, rgba(45, 212, 191, 0) 46%),
    radial-gradient(120% 160% at 0% 120%, rgba(16, 185, 129, .22) 0%, rgba(16, 185, 129, 0) 50%),
    linear-gradient(118deg, #0b1220 0%, #0e3a34 52%, #0b4f45 100%);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 24px 60px -28px rgba(4, 60, 50, .95), inset 0 1px 0 rgba(255, 255, 255, .10);
}
/* filete superior de acento (linha premium) */
.v2-strike-hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; z-index: 2;
  background: linear-gradient(90deg, #34d399, #22d3ee 60%, transparent);
}
.v2-strike-hero-ic {
  width: 66px; height: 66px; border-radius: 18px; flex: 0 0 auto; display: grid; place-items: center;
  font-size: 2rem; color: #ecfdf5; z-index: 1;
  background: linear-gradient(160deg, rgba(52, 211, 153, .38), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 10px 22px -10px rgba(0, 0, 0, .5);
}
.v2-strike-hero-main { min-width: 0; flex: 1; z-index: 1; }
.v2-strike-hero-lbl { font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #a7f3d0; }
.v2-strike-hero-val {
  font-size: 2.9rem; font-weight: 800; line-height: 1.02; margin: 8px 0 6px; letter-spacing: -1px;
  background: linear-gradient(92deg, #ffffff 0%, #a7f3d0 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #fff;
}
.v2-strike-hero-sub { font-size: .92rem; font-weight: 600; color: #cbf6ea; opacity: .85; }
@media (max-width: 720px) {
  .v2-strike-hero { padding: 22px; gap: 16px; }
  .v2-strike-hero-val { font-size: 2.1rem; }
  .v2-strike-hero-ic { width: 54px; height: 54px; font-size: 1.6rem; }
}
/* Variante COMPACTA (dashboard da empresa): mesmo visual premium, tamanho enxuto. */
.v2-strike-hero--sm { padding: 10px 15px; gap: 11px; border-radius: 12px; }
.v2-strike-hero--sm .v2-strike-hero-ic { width: 34px; height: 34px; border-radius: 9px; font-size: .98rem; }
.v2-strike-hero--sm .v2-strike-hero-lbl { font-size: .6rem; letter-spacing: .06em; }
.v2-strike-hero--sm .v2-strike-hero-val { font-size: 1.2rem; margin: 1px 0 0; letter-spacing: -.3px; }
.v2-strike-hero--sm .v2-strike-hero-unit { font-size: .82rem; font-weight: 700; -webkit-text-fill-color: #a7f3d0; color: #a7f3d0; }
@media (max-width: 720px) {
  .v2-strike-hero--sm .v2-strike-hero-val { font-size: 1.1rem; }
  .v2-strike-hero--sm .v2-strike-hero-ic { width: 32px; height: 32px; font-size: .9rem; }
}

/* ---------- F) Widgets do dashboard: últimas mensagens disparadas ---------- */
.v2-lastmsg { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.v2-lastmsg-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.v2-lastmsg-item:last-child { border-bottom: 0; }
.v2-lastmsg-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.v2-lastmsg-main { min-width: 0; flex: 1; }
.v2-lastmsg-top { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; }
.v2-lastmsg-top .tel { font-weight: 600; }
.v2-lastmsg-top .time { color: var(--muted); white-space: nowrap; }
.v2-lastmsg-text { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-lastmsg-st { font-size: .68rem; font-weight: 600; white-space: nowrap; align-self: center; }

/* ---------- G) KPI "Taxa de entrega" em destaque (azul tema, texto branco) ---------- */
.v2-kpi--taxa { background: linear-gradient(135deg, #6f9bff 0%, #4979FF 42%, #1e3a8a 100%); border-color: var(--accent); color: #fff; }
.v2-kpi--taxa::after { display: none; } /* remove a barra de acento no topo */
.v2-kpi--taxa .v2-kpi-label,
.v2-kpi--taxa .v2-kpi-value,
.v2-kpi--taxa .v2-kpi-foot,
.v2-kpi--taxa .v2-kpi-value.is-counting { color: #fff; }
.v2-kpi--taxa .v2-kpi-label, .v2-kpi--taxa .v2-kpi-foot { opacity: .9; }
[data-bs-theme="dark"] .v2-kpi--taxa { box-shadow: var(--shadow-sm), 0 0 36px -16px rgba(73,121,255,.6); }

/* ---------- H) Modal Nova campanha: layout 2 colunas + mockup de celular ---------- */
.v2-camp-grid { display: grid; grid-template-columns: 1.15fr .85fr; }
@media (max-width: 767.98px) { .v2-camp-grid { grid-template-columns: 1fr; } }
.v2-camp-form { padding: 20px 22px; min-width: 0; }
.v2-camp-preview { padding: 20px 22px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; }
@media (max-width: 767.98px) { .v2-camp-preview { border-left: 0; border-top: 1px solid var(--border); } }
.v2-preview-label { align-self: flex-start; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }
.v2-preview-note { font-size: .7rem; color: var(--muted); text-align: center; margin: 12px 0 0; max-width: 240px; }

.v2-ch-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.v2-ch-pill { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: var(--r-sm); font-size: .72rem; font-weight: 600; cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast); }
.v2-ch-pill i { font-size: 1.1rem; }
.v2-ch-pill:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--text); }
.v2-ch-pill.active { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); }

.v2-phone { width: 270px; max-width: 100%; aspect-ratio: 9/19; background: #0b1020; border-radius: 34px; padding: 10px; box-shadow: 0 18px 40px -12px rgba(20,24,40,.45), inset 0 0 0 2px rgba(255,255,255,.06); position: relative; }
.v2-phone-notch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 96px; height: 18px; background: #0b1020; border-radius: 0 0 12px 12px; z-index: 2; }
.v2-phone-screen { background: #f2f4f8; border-radius: 26px; height: 100%; overflow: hidden; position: relative; }
.v2-pv { display: flex; flex-direction: column; height: 100%; }
.v2-pv-bar { background: #fff; border-bottom: 1px solid #e7eaf0; padding: 26px 12px 9px; font-size: .74rem; font-weight: 700; color: #1f2430; text-align: center; }
.v2-pv-bar i { color: #4979FF; }
.v2-pv-chat { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.v2-pv-from { font-size: .66rem; color: #8a93a6; font-weight: 600; margin-left: 4px; }
.v2-pv-bubble { align-self: flex-start; max-width: 85%; padding: 9px 11px; border-radius: 14px 14px 14px 4px; font-size: .78rem; line-height: 1.35; color: #1f2430; word-break: break-word; white-space: pre-wrap; }
.v2-pv-bubble--sms { background: #e6e9ef; }
.v2-pv-time { font-size: .6rem; color: #aab1c0; margin: 2px 0 0 6px; }
.v2-pv-chat--wa { background: #e5ddd5; background-image: radial-gradient(rgba(0,0,0,.03) 1px, transparent 1px); background-size: 14px 14px; }
.v2-pv-wahead { background: #075e54; color: #fff; padding: 26px 12px 9px; display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700; }
.v2-pv-avatar { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.25); flex: none; }
.v2-pv-bubble--wa { background: #fff; align-self: flex-start; box-shadow: 0 1px 1px rgba(0,0,0,.08); overflow: hidden; }
.v2-pv-bubble--wa .v2-pv-time { display: block; text-align: right; }
.v2-pv-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(20,24,40,.08); max-width: 92%; }
.v2-pv-card-body { padding: 11px 12px 13px; }
.v2-pv-title { font-weight: 700; font-size: .82rem; color: #1f2430; margin-bottom: 4px; }
.v2-pv-card .v2-pv-msg { font-size: .76rem; color: #41485a; line-height: 1.35; display: block; white-space: pre-wrap; }
.v2-pv-btn { margin-top: 10px; width: 100%; border: 0; background: #4979FF; color: #fff; font-weight: 600; font-size: .76rem; padding: 8px; border-radius: 9px; cursor: default; }
.v2-pv-img { width: 100%; display: block; max-height: 150px; object-fit: cover; }
.v2-pv-bubble--wa .v2-pv-img { border-radius: 8px; margin-bottom: 6px; }
.v2-pv-call { flex: 1; background: linear-gradient(180deg, #1e3a8a, #4979FF); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; }
.v2-pv-call-ico { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 1.5rem; }
.v2-pv-call-brand { font-size: 1rem; font-weight: 700; }
.v2-pv-call-sub { font-size: .76rem; opacity: .85; }
.v2-pv-wave { display: flex; align-items: center; gap: 3px; height: 30px; margin: 6px 0; }
.v2-pv-wave span { width: 3px; border-radius: 2px; background: rgba(255,255,255,.85); animation: v2wave 1s ease-in-out infinite; }
.v2-pv-wave span:nth-child(1){height:8px;animation-delay:0s}.v2-pv-wave span:nth-child(2){height:18px;animation-delay:.1s}.v2-pv-wave span:nth-child(3){height:28px;animation-delay:.2s}.v2-pv-wave span:nth-child(4){height:14px;animation-delay:.3s}.v2-pv-wave span:nth-child(5){height:24px;animation-delay:.4s}.v2-pv-wave span:nth-child(6){height:10px;animation-delay:.5s}.v2-pv-wave span:nth-child(7){height:18px;animation-delay:.6s}
@keyframes v2wave { 0%,100%{transform:scaleY(.5)} 50%{transform:scaleY(1)} }
@media (prefers-reduced-motion: reduce){ .v2-pv-wave span{animation:none} }
.v2-pv-call-file { font-size: .7rem; opacity: .8; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-pv-msg:empty::after { content: "Sua mensagem aparece aqui…"; color: #aab1c0; }

/* ============================================================================
   Ajustes MOBILE (<= 767.98px). Desktop/tablet NÃO são afetados.
   ========================================================================== */
/* 7 — remover legendas de gráfico (mobile + desktop). As notas de tabela/página
      usam mt-3 / mb-0 / text-center; só as de gráfico usam mt-2. */
.v2-source-note.mt-2 { display: none; }
/* botão "voltar" do chat (item 5): escondido no desktop, aparece só no mobile */
.pa-chat-back { display: none; }

@media (max-width: 767.98px) {
  /* 1 — Saldo por canal: empilha (ícone em cima, número, legenda) e reduz tamanhos */
  .v2-saldo-card { flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 6px; }
  .v2-saldo-card .v2-card-icon { width: 30px; height: 30px; font-size: .9rem; }
  .v2-saldo-card .v2-card-body { display: flex; flex-direction: column-reverse; width: 100%; min-width: 0; }
  .v2-saldo-card .v2-card-value { font-size: 1.05rem; }
  .v2-saldo-card .v2-card-label { font-size: .66rem; line-height: 1.2; }

  /* 3 & 6 — reduzir os números dos KPIs (Enviados/Entregues/Não entregues e boxes do Consumo & Saldo) */
  .v2-kpi-value { font-size: 1.15rem; }
  .v2-kpi--hero .v2-kpi-value { font-size: 1.3rem; }
  .v2-kpi.v2-kpi--cost .v2-kpi-value,
  .v2-kpi.v2-kpi--cost.v2-kpi--hero .v2-kpi-value { font-size: 1rem; }

  /* 2 — filtro de data não pode vazar: quebra linha e botão em largura total */
  .v2-daterange { flex-wrap: wrap; width: 100%; }
  .v2-daterange > div { flex: 1 1 42%; min-width: 0; }
  .v2-daterange > div .form-control { width: 100%; }
  .v2-daterange .btn { flex: 1 1 100%; margin-top: 4px; }

  /* 4 — abas de produto/pushagent/pushtickets: só ícones (esconde o texto) */
  .v2-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .v2-tabs .nav-link { font-size: 0; padding: 8px 13px; white-space: nowrap; }
  .v2-tabs .nav-link i { font-size: 1.1rem; margin: 0 !important; }

  /* 5 — Chat do PushAgent: um painel por vez (lista OU conversa) */
  #paChatShell .col-md-8 { display: none; }
  #paChatShell.pa-open .col-md-4 { display: none; }
  #paChatShell.pa-open .col-md-8 { display: flex; }
  .pa-chat-back { display: inline-flex; }
}

/* ============================================================================
   Modal "Visualizar" — dashboard cinematográfico de campanha (campaign-view.js)
   Reusa tokens (--accent, --grad-brand, --surface, --ease). Dark-mode automático.
   ============================================================================ */
.v2-cv .modal-content, .v2-cv-content { border: 0; border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: 0 40px 120px rgba(10,15,35,.45); display: flex; flex-direction: column; max-height: 100%; }
@media (max-width: 991.98px){ .v2-cv .modal-content, .v2-cv-content { border-radius: 0; } }
/* Layout de rolagem: cabeçalho e rodapé fixos, corpo rola (min-height:0 permite encolher). */
.v2-cv-hero { flex: 0 0 auto; }
.v2-cv-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.v2-cv-footer { flex: 0 0 auto; }

/* Hero */
.v2-cv-hero { position: relative; padding: 22px 26px 16px; background: var(--grad-brand); color: #fff; overflow: hidden; }
.v2-cv-hero-bg { position: absolute; inset: 0; background:
    radial-gradient(600px 200px at 15% -20%, rgba(255,255,255,.28), transparent 60%),
    radial-gradient(500px 260px at 100% 0%, rgba(255,255,255,.18), transparent 55%);
  opacity: .9; animation: cvHero 14s var(--ease) infinite alternate; }
@keyframes cvHero { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-14px,6px,0) scale(1.06); } }
.v2-cv-hero-inner { position: relative; z-index: 1; }
.v2-cv-hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.v2-cv-chan { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: rgba(255,255,255,.20); padding: 3px 10px; border-radius: 999px; }
.v2-cv-name { margin: 8px 0 6px; font-size: clamp(20px, 2.4vw, 28px); font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.v2-cv-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; opacity: .96; }
.v2-cv-sub .badge { font-weight: 700; }
.v2-cv-dot { opacity: .5; }
.v2-cv-since { opacity: .9; }
.v2-cv-close { filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); opacity: .9; }
.v2-cv-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.v2-cv-chip { border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; font-size: 12.5px; font-weight: 600; padding: 5px 14px; border-radius: 999px; cursor: pointer; transition: background var(--t) var(--ease), transform var(--t) var(--ease); }
.v2-cv-chip:hover { background: rgba(255,255,255,.22); }
.v2-cv-chip.active { background: #fff; color: var(--accent); border-color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.16); }

/* Body */
.v2-cv-body { padding: 20px 24px 24px; background: var(--surface-2); }

/* KPIs */
.v2-cv-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 991.98px){ .v2-cv-kpis { grid-template-columns: repeat(2, 1fr); } }
.v2-cv-kpi { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border, rgba(0,0,0,.06)); border-radius: 14px; padding: 14px 16px; opacity: 0; transform: translateY(10px); animation: cvUp .5s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms + 60ms); transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.v2-cv-kpi:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(20,30,70,.10); }
.v2-cv-kpi--hero { background: linear-gradient(135deg, var(--accent-weak), transparent); border-color: var(--accent); }
.v2-cv-kpi-ic { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-weak); color: var(--accent); font-size: 18px; }
.v2-cv-kpi-body { display: flex; flex-direction: column; min-width: 0; }
.v2-cv-kpi-lbl { font-size: 11.5px; color: var(--muted, #6b7280); font-weight: 600; letter-spacing: .01em; }
.v2-cv-kpi-val { font-size: 22px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.v2-cv-kpi-foot { font-size: 10.5px; color: var(--muted, #8a93a6); }
@keyframes cvUp { to { opacity: 1; transform: translateY(0); } }

/* Grids de painéis */
.v2-cv-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; margin-top: 16px; }
.v2-cv-grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 991.98px){ .v2-cv-grid, .v2-cv-grid2 { grid-template-columns: 1fr; } }
.v2-cv-panel { background: var(--surface); border: 1px solid var(--border, rgba(0,0,0,.06)); border-radius: 16px; padding: 16px 18px; opacity: 0; animation: cvUp .55s var(--ease) forwards; animation-delay: .18s; }
.v2-cv-panel--pie { grid-row: span 1; }
.v2-cv-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.v2-cv-panel-title { font-size: 13.5px; font-weight: 700; }

/* Tabs do donut */
.v2-cv-tabs, .v2-cv-tab { display: inline-flex; }
.v2-cv-tabs { gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.v2-cv-tab { border: 0; background: transparent; font-size: 12px; font-weight: 600; color: var(--muted, #6b7280); padding: 4px 12px; border-radius: 999px; cursor: pointer; transition: all var(--t) var(--ease); }
.v2-cv-tab.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* Pills de status */
.v2-cv-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.v2-cv-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted, #6b7280); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; }
.v2-cv-pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.v2-cv-pill b { color: var(--text, inherit); }

/* Resumo executivo */
.v2-cv-summary { background: linear-gradient(135deg, var(--accent-weak), transparent); border-color: var(--accent); }
.v2-cv-summary-text { margin: 0; font-size: 14.5px; line-height: 1.65; }

/* Info (dl) */
.v2-cv-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.v2-cv-info dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #8a93a6); font-weight: 600; margin-bottom: 2px; }
.v2-cv-info dd { margin: 0; font-size: 14px; font-weight: 600; }

/* Amostra */
.v2-cv-sample td { padding-top: 8px; padding-bottom: 8px; }
.v2-cv-empty { display: grid; place-items: center; min-height: 220px; color: var(--muted, #8a93a6); font-size: 13px; }

/* Footer */
.v2-cv-footer { background: var(--surface); border-top: 1px solid var(--border, rgba(0,0,0,.06)); }
.v2-cv-foot-note i { color: var(--accent); }

/* Respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce){
  .v2-cv-hero-bg { animation: none; }
  .v2-cv-kpi, .v2-cv-panel { animation: none; opacity: 1; transform: none; }
}

/* ---------- Resumo do filtro (aba Relatórios) — box redesenhado ---------- */
.v2-rs { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; gap: 16px; }
.v2-rs-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; flex: 1 1 auto; }
.v2-rs-total { display: flex; align-items: baseline; gap: 8px; }
.v2-rs-total-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.v2-rs-total-lbl { font-size: 12.5px; color: var(--muted, #6b7280); }
.v2-rs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.v2-rs-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid transparent; transition: transform var(--t) var(--ease); }
.v2-rs-chip:hover { transform: translateY(-1px); }
.v2-rs-chip.is-billed { border-color: var(--border, rgba(0,0,0,.08)); }
.v2-rs-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 9px; }
.v2-rs-chip-lbl { color: var(--muted, #6b7280); }
.v2-rs-chip b { font-weight: 700; font-variant-numeric: tabular-nums; }
.v2-rs-billic { font-size: 11px; color: #16a34a; opacity: .85; }
.v2-rs-cost { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 3px; padding: 12px 18px; border-radius: 14px; background: linear-gradient(135deg, var(--accent-weak), transparent); border: 1px solid var(--accent); min-width: 190px; }
.v2-rs-cost-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #8a93a6); font-weight: 600; }
.v2-rs-cost-val { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.1; }
@media (max-width: 575.98px){ .v2-rs { flex-direction: column; } .v2-rs-cost { align-items: flex-start; } }

/* ── Tarja discreta: voltar ao painel antigo (V1) ─────────────────────────── */
.v2-back-v1{
  display:flex; align-items:center; justify-content:center; gap:4px;
  height:26px; font-size:11.5px; font-weight:500; letter-spacing:.01em;
  color:var(--muted); text-decoration:none;
  background:var(--accent-weak); border-bottom:1px solid var(--border);
  transition:color .15s ease, background .15s ease;
}
.v2-back-v1:hover{ color:var(--accent); background:color-mix(in srgb, var(--accent) 15%, transparent); }
.v2-back-v1 i{ font-size:15px; line-height:1; margin-right:-2px; }
.v2-back-v1-tag{ font-weight:700; color:var(--accent); letter-spacing:.03em; }
