:root {
  color-scheme: dark;
  --brand: #ff0f45;
  --brand-press: #e00a3b;
  --accent: #8b2be8;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #8a8a93;
  --bg: #0a0a0a;
  --card: #141416;
  --surface: #1a1a1e;
  --line: #27272c;
  --line-strong: #3a3a42;
  --ok: #22c55e;
  --danger: #f87171;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
}

.mark {
  height: 34px;
  width: auto;
  display: block;
}

.credits {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.credits span {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.credits strong {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
}

.credits.neg strong { color: var(--danger); }

/* ——— Screens ——— */
.screen {
  display: none;
  flex: 1;
  animation: in 0.25s var(--ease);
}

.screen.active { display: block; }

@keyframes in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page {
  width: min(960px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2.25rem 0 3rem;
}

.page.wide {
  width: min(1180px, calc(100% - 3rem));
}

.page-hero {
  margin-bottom: 1.75rem;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--brand);
  margin-bottom: 0.55rem;
}

.page-hero h1,
.page-head h1 {
  font-size: clamp(1.8rem, 2.5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.lede {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-head .meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ——— Home tiles ——— */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.home-grid .tile.primary {
  grid-column: span 1;
}

.data-table-head,
.data-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 1.1fr 0.9fr 0.8fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1.1rem;
}

.data-table-head {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.data-row {
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.data-row:last-child { border-bottom: 0; }
.data-row:hover { background: var(--surface); }

.data-row .name {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.data-row .sub {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.5rem;
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
}

.pill.ok {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.pill.bad {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.pill.warn {
  background: rgba(251, 146, 60, 0.12);
  color: #fdba74;
}

.mini-list {
  display: grid;
  gap: 0.55rem;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.mini-item:last-child { border-bottom: 0; }

.mini-item.campaign-report {
  align-items: flex-start;
}
.clickable-campaign {
  cursor: pointer;
}
.clickable-campaign:hover {
  background: var(--surface);
}
.data-row.clickable-campaign:focus-visible,
.mini-item.clickable-campaign:focus-visible,
.fin-row.clickable-campaign:focus-visible {
  outline: 2px solid rgba(255, 15, 69, 0.35);
  outline-offset: -2px;
}
.campaign-detail-card {
  max-height: min(90vh, 920px);
  overflow: auto;
}
.campaign-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.campaign-detail-head h3 {
  margin: 0 0 0.25rem;
}
.campaign-detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.85rem;
  margin: 0.85rem 0;
}
.campaign-detail-card .card.flat {
  box-shadow: none;
  border: 1px solid var(--line);
}
.campaign-msg {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.45;
  font-size: 0.95rem;
}
.detail-kv {
  display: grid;
  gap: 0.55rem;
}
.detail-kv > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
}
.detail-kv span {
  color: var(--muted);
}
.detail-kv strong {
  text-align: right;
  font-weight: 650;
}
@media (max-width: 720px) {
  .campaign-detail-grid {
    grid-template-columns: 1fr;
  }
}
.report-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.35rem;
}
.report-metrics b {
  font-weight: 700;
  color: var(--ink);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}
.mini-item strong {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mini-item span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.report-stats {
  margin-bottom: 1rem;
}

.stats.compact {
  margin-top: 0.5rem;
}

.data-table-head.leads-head,
.data-row.leads-row {
  grid-template-columns: minmax(0, 1.6fr) 0.8fr 0.7fr minmax(0, 1.2fr) auto;
}

.data-row .sub-cell {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#leadsEmpty.hidden { display: none !important; }

.base-group {
  border-bottom: 1px solid var(--line);
}

.base-group:last-child { border-bottom: 0; }

.base-group .data-row.leads-row {
  border-bottom: 0;
}

.base-drawer {
  background: var(--surface);
  border-top: 0;
}

.base-drawer[hidden] {
  display: none !important;
}

.base-drawer > .data-row {
  border-top: 1px solid var(--line);
}

.data-row.leads-row.parent.clickable {
  cursor: pointer;
}

.data-row.leads-row.parent.clickable:hover {
  background: var(--surface);
}

.data-row.leads-row.child {
  background: transparent;
  padding-left: 0.35rem;
}

.drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 0;
  background: rgba(255, 15, 69, 0.14);
  color: var(--brand);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.drawer-toggle:hover {
  background: rgba(255, 15, 69, 0.14);
}

.drawer-toggle .chevron {
  font-size: 0.85rem;
  line-height: 1;
}

.tree-pad {
  display: inline-block;
  flex-shrink: 0;
}

.drawer-spacer {
  width: 2.1rem;
  flex-shrink: 0;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  justify-content: flex-end;
}

.btn.text.danger-text {
  color: var(--danger);
}

.btn.text.danger-text:hover {
  background: rgba(248, 113, 113, 0.08);
}

@media (max-width: 960px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .data-table-head { display: none; }

  .data-row {
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
  }

  .data-row > :nth-child(2),
  .data-row > :nth-child(3),
  .data-row > :nth-child(4) {
    grid-column: 1;
    font-size: 0.8rem;
    color: var(--muted);
  }
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.35rem;
  min-height: 220px;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s var(--ease), box-shadow 0.15s ease;
}

.tile:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.tile.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.tile.primary:hover {
  background: var(--brand-press);
  border-color: var(--brand-press);
}

.tile-kicker {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 0.55rem;
}

.tile-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.tile-desc {
  font-size: 0.92rem;
  line-height: 1.45;
  opacity: 0.78;
  margin-top: 0.25rem;
}

.tile-cta {
  margin-top: auto;
  padding-top: 1.25rem;
  font-size: 0.9rem;
  font-weight: 650;
}

/* ——— Casting ——— */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 0.35rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

input[type="search"] {
  width: min(320px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  background: var(--card);
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cast-list {
  max-height: min(58vh, 620px);
  overflow: auto;
}

.cast-row {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.cast-row:last-child { border-bottom: 0; }
.cast-row:hover { background: var(--surface); }
.cast-row.on { background: rgba(255, 15, 69, 0.09); }

.cast-row input { accent-color: var(--brand); }

.cast-row .name {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cast-row .meta-line {
  color: var(--muted);
  font-size: 0.84rem;
}

.cast-row .badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border-radius: 5px;
  padding: 0.28rem 0.45rem;
  justify-self: end;
}

.cast-row .badge.interno {
  color: var(--brand);
  background: rgba(255, 15, 69, 0.14);
}

/* ——— Send ——— */
.send-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 1rem;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}

.card.stack {
  display: flex;
  flex-direction: column;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.card-head h2 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.card-actions {
  display: flex;
  gap: 0.25rem;
}

.hint {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.7rem;
}

/* ——— Visualizadores + encurtador ——— */
.viewer-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.viewer-input input {
  flex: 1 1 140px;
  min-width: 0;
}

.viewer-input .btn {
  flex: 0 0 auto;
}

.input-err {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12) !important;
}

.viewer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.55rem 0 0.35rem;
}

.viewer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.35rem 0.3rem 0.6rem;
  background: rgba(255, 15, 69, 0.1);
  border: 1px solid rgba(255, 15, 69, 0.18);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--ink);
}

.viewer-chip button {
  border: 0;
  background: rgba(255, 15, 69, 0.12);
  color: var(--brand);
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
}

.viewer-chip button:hover {
  background: rgba(255, 15, 69, 0.2);
}

.shortener-card {
  margin-top: 1rem;
}

.short-raw {
  margin-top: 0.6rem;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.4;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.viewer-chip.saved {
  cursor: pointer;
  border-style: dashed;
}

.viewer-chip.saved:hover {
  border-color: var(--brand);
  background: rgba(255, 15, 69, 0.1);
}

.saved-viewers {
  margin-top: 0.5rem;
}

.classify-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 15, 69, 0.25);
  background: rgba(255, 15, 69, 0.07);
  border-radius: 10px;
}

.classify-banner .eyebrow {
  display: block;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.classify-banner strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.classify-banner .sub {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.wizard-steps {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.wizard-panel {
  margin-bottom: 0.5rem;
}

/* ——— Classificação de campanha (legado / wizard) ——— */
.classify {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0.2rem 0;
}

.classify-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.classify select,
.field select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  width: 100%;
}

.field.inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-direction: row;
}

.field.inline span {
  font-size: 0.75rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field.inline input {
  width: auto;
}

.field.hidden { display: none !important; }

/* ——— Tabelas financeiras ——— */
.fin-table {
  display: flex;
  flex-direction: column;
}

.fin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.fin-row:last-child { border-bottom: 0; }

.fin-row .fin-name {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-row.obj .fin-name { font-weight: 650; }

.fin-row.vert .fin-name,
.fin-row.vert .fin-sub {
  color: var(--muted);
  font-size: 0.83rem;
}

.fin-row .fin-sub {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.fin-row .fin-num {
  font-family: var(--mono);
  font-size: 0.88rem;
  text-align: right;
  white-space: nowrap;
}

.fin-tag {
  display: block;
  font-style: normal;
  color: var(--faint);
  font-size: 0.76rem;
  margin-top: 0.1rem;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.86rem;
  padding: 0.5rem 0;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.mini-row:last-child { border-bottom: 0; }

.mini-row .name { display: block; font-weight: 550; font-size: 0.9rem; }
.mini-row .sub { display: block; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 720px) {
  .classify-row { grid-template-columns: 1fr; }
}

textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--ink);
}

#list {
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
  min-height: 340px;
  resize: vertical;
}

#message {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
}

.status {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.status.ok { color: var(--ok); font-weight: 600; }
.status.bad { color: var(--danger); }

.note {
  margin-top: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  background: rgba(250, 204, 21, 0.1);
  color: #fde68a;
  font-size: 0.84rem;
  line-height: 1.4;
}

.note.danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  margin-top: 0.55rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.check input { accent-color: var(--brand); }

.field {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.95rem;
}

.field span {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ——— Buttons ——— */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover:not(:disabled) { background: var(--brand-press); }
.btn.primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn.ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover { background: var(--bg); }

.btn.text {
  border: 0;
  background: none;
  color: var(--brand);
  padding: 0.3rem 0.4rem;
  font-size: 0.82rem;
}

.btn.text:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.result {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.result.ok { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.result.err { background: rgba(248, 113, 113, 0.12); color: #fca5a5; }

.drop {
  display: grid;
  gap: 0.35rem;
  place-items: center;
  text-align: center;
  min-height: 180px;
  padding: 1.5rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop:hover,
.drop.drag {
  border-color: var(--brand);
  background: rgba(255, 15, 69, 0.07);
}

.drop-title {
  font-weight: 650;
  letter-spacing: -0.02em;
}

.drop-sub {
  font-size: 0.84rem;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.stat {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.75rem 0.8rem;
}

.stat span {
  display: block;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.25rem;
}

.stat strong {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
}

.stat.ok strong { color: var(--ok); }
.stat.bad strong { color: var(--danger); }

#importhint code,
#importHint code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

#importPreview {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  min-height: 220px;
}

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(255, 15, 69, 0.18), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(139, 43, 232, 0.16), transparent 60%),
    var(--bg);
}

.auth-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-mark {
  height: 96px;
  width: auto;
  margin-bottom: 0.75rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  margin: 0.2rem 0 0.5rem;
}

.auth-card > .btn {
  width: 100%;
  margin-bottom: 0.75rem;
}

.auth-form {
  text-align: left;
}

.auth-form .btn {
  width: 100%;
  margin-top: 1.25rem;
}

.auth-lede {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.user-email {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden,
.app.hidden,
.auth-gate.hidden {
  display: none !important;
}

.table-wrap.flat {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.schedule-head {
  grid-template-columns: minmax(0, 1.6fr) 1fr 0.8fr 0.8fr auto;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 1rem;
}

.audience-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  padding: 0.35rem 0.55rem 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 15, 69, 0.1);
  border: 1px solid rgba(255, 15, 69, 0.2);
  font-size: 0.82rem;
  max-width: 100%;
}

.audience-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audience-chip .btn {
  padding: 0 0.25rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

.audience-picker-list {
  max-height: min(420px, 55vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0.75rem 0 1rem;
}

.audience-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: var(--card);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

.audience-pick:last-child { border-bottom: 0; }

.audience-pick:hover {
  background: rgba(255, 15, 69, 0.07);
}

.audience-pick.child {
  padding-left: 1.6rem;
  background: var(--surface);
}

.audience-pick .name {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
}

.audience-pick .sub {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.audience-pick .count {
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.audience-pick .kind {
  color: var(--faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.modal.hidden {
  display: none !important;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 12px;
  padding: 1.35rem 1.3rem;
  box-shadow: var(--shadow);
}

.modal-card.wide {
  width: min(520px, 100%);
}

.modal-card h3 {
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.modal-card > p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  margin-bottom: 1rem;
}

.use-mode {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.use-option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: var(--surface);
}

.use-option:has(input:checked) {
  border-color: rgba(255, 15, 69, 0.45);
  background: rgba(255, 15, 69, 0.07);
}

.use-option input {
  margin-top: 0.2rem;
  accent-color: var(--brand);
}

.use-option strong {
  display: block;
  font-size: 0.95rem;
}

.use-option small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  margin-top: 0.15rem;
}

.split-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 0 0.25rem;
  border-top: 1px solid var(--line);
  margin-bottom: 0.5rem;
}

.split-panel.hidden { display: none !important; }

.split-mode {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.check.compact {
  font-size: 0.88rem;
}

.data-row.leads-row.child {
  background: var(--surface);
}

.data-row.leads-row .tree-name {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.data-row.leads-row .tree-indent {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.4;
  flex-shrink: 0;
  padding-top: 0.05rem;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

/* ——— Config / Fornecedores ——— */
.config-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.config-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}

.config-tab.on {
  background: rgba(255, 15, 69, 0.14);
  color: var(--brand);
}

.provider-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.provider-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.provider-card.active {
  border-color: rgba(255, 15, 69, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 15, 69, 0.14), var(--shadow);
}

.provider-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.provider-card-head h2 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.provider-card-head p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 0.25rem;
}

.provider-fields {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.provider-fields .field input {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.provider-meta {
  font-size: 0.78rem;
  color: var(--faint);
}

.provider-meta a {
  color: var(--brand);
  text-decoration: none;
}

.provider-meta a:hover { text-decoration: underline; }

@media (max-width: 960px) {
  .home-grid,
  .send-grid {
    grid-template-columns: 1fr;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    flex-wrap: wrap;
  }

  .cast-row {
    grid-template-columns: 1.1rem 1fr auto;
  }

  .cast-row .meta-line {
    grid-column: 2;
  }
}

/* ================= CRM · 0. Tokens novos + correções AA ================= */
:root {
  --brand-ink: #ff4d73;          /* vermelho para TEXTO sobre fundo escuro/tint: 5.2:1 */
  --accent-ink: #b57bff;         /* roxo (IA) para TEXTO: 6.3:1 */
  --accent-bg: rgba(139, 43, 232, 0.16);
  --warn: #fdba74;
  --info: #7dd3fc;
  --field-line: #66666f;         /* borda de campo: 3.24:1 (WCAG 1.4.11) */
  --side-w: 240px;
  --side-w-mini: 64px;
  --st-cadastro: #7dd3fc;
  --st-ftd: #c4b5fd;
  --st-ativo: #4ade80;
  --st-vip: #fcd34d;
  --st-risco: #fb923c;
  --st-inativo: #a1a1aa;
}

.btn.primary { background: var(--brand-press); }                    /* branco: 4.91:1 */
.btn.primary:hover:not(:disabled) { background: #c70833; }          /* 5.98:1 */
.chip.on { color: var(--bg); }                                      /* bug: era #fff sobre --ink */
.chips { flex-wrap: wrap; }
.nav-link.on,
.config-tab.on { color: var(--brand-ink); }

:where(button, a, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

input[type="search"] { color: var(--ink); }

select,
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--field-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

select:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--brand);
}

/* opcional: borda AA em todos os campos de texto existentes */
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"] { border-color: var(--field-line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ================= CRM · 1. Shell + sidebar ================= */
.app.shell { flex-direction: row; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page.full { width: min(1440px, calc(100% - 3rem)); }

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--side-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 30;
  transition: width 0.2s var(--ease);
}

.side-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0.75rem 0.75rem 0.9rem;
}
.side-brand .mark { height: 30px; }
.mark-icon { display: none; width: 32px; height: 32px; border-radius: 8px; }

.side-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0.75rem 0.75rem;
}

.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.25rem 0.5rem 1rem;
}

.side-group { display: flex; flex-direction: column; gap: 2px; }

.side-label {
  padding: 0.35rem 0.65rem 0.25rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.side-link:hover { background: var(--surface); color: var(--ink); }
.side-link.on { background: rgba(255, 15, 69, 0.12); color: var(--ink); }
.side-link.on .icon { color: var(--brand); }
.side-link.on::before {
  content: "";
  position: absolute;
  left: -0.5rem;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.side-count {
  margin-left: auto;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
}
.side-count:empty { display: none; }

.side-foot {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem 0.9rem;
  border-top: 1px solid var(--line);
}
.side-foot .credits {
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  padding: 0.25rem 0.65rem 0;
  border-left: 0;
}
.side-foot .user-email { flex-basis: 100%; max-width: 100%; }

.side-backdrop,
.mobile-bar { display: none; }

/* Recolhida (só desktop; no mobile a gaveta é sempre larga) */
@media (min-width: 900px) {
  .shell.side-collapsed .sidebar { width: var(--side-w-mini); }
  .shell.side-collapsed .side-brand { flex-direction: column; padding: 0.75rem 0; }
  .shell.side-collapsed .side-brand .mark { display: none; }
  .shell.side-collapsed .mark-icon { display: block; }
  .shell.side-collapsed .side-collapse .icon { transform: rotate(180deg); }
  .shell.side-collapsed .side-cta { margin: 0 0.6rem 0.75rem; padding: 0.6rem 0; }
  .shell.side-collapsed .side-link { justify-content: center; padding: 0.6rem 0; }
  .shell.side-collapsed .side-text {           /* some da tela, continua no leitor */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .shell.side-collapsed .side-label { display: none; }
  .shell.side-collapsed .side-group + .side-group {
    border-top: 1px solid var(--line);
    padding-top: 0.75rem;
  }
  .shell.side-collapsed .side-count {
    position: absolute;
    top: 0.35rem;
    right: 0.6rem;
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    font-size: 0;
    background: var(--accent-ink);
  }
  .shell.side-collapsed .side-foot .credits { display: none; }
}

/* Mobile: gaveta off-canvas */
@media (max-width: 899px) {
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: var(--card);
    border-bottom: 1px solid var(--line);
  }
  .mobile-bar .mark { height: 28px; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    box-shadow: var(--shadow);
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.6);
  }
  .side-collapse { display: none; }
  .page,
  .page.wide,
  .page.full { width: calc(100% - 2rem); padding-top: 1.25rem; }
}

/* ================= CRM · 2. Página, KPI, funil, estágio ================= */
.section-label {
  margin: 1.5rem 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.sticky-aside { position: sticky; top: 1rem; }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}
.kpi {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  min-width: 0;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  color: inherit;
  text-align: left;
}
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--line-strong); }
.kpi.alert { border-color: rgba(248, 113, 113, 0.4); }
.kpi-label {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.kpi-value {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.kpi-delta { font-family: var(--mono); font-weight: 500; }
.kpi-delta.good { color: var(--ok); }
.kpi-delta.bad { color: var(--danger); }

/* Mapa de estágio -> cor (vale para badge, funil, amostras) */
[data-stage="cadastro"] { --c: var(--st-cadastro); }
[data-stage="ftd"]      { --c: var(--st-ftd); }
[data-stage="ativo"]    { --c: var(--st-ativo); }
[data-stage="vip"]      { --c: var(--st-vip); }
[data-stage="risco"]    { --c: var(--st-risco); }
[data-stage="inativo"]  { --c: var(--st-inativo); }

.stage {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--surface);                                         /* fallback */
  background: color-mix(in srgb, var(--c, var(--muted)) 14%, transparent);
  color: var(--c, var(--muted));
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}
.stage::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.tag {
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Funil do ciclo */
.funnel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) 1px repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
.funnel-step {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.funnel-step:hover { border-color: var(--c, var(--line-strong)); }
.funnel-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.funnel-label::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--c, var(--muted));
}
.funnel-value {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.funnel-bar { height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.funnel-bar > i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  border-radius: inherit;
  background: var(--c, var(--brand));
}
.funnel-conv { font-size: 0.76rem; color: var(--muted); }
.funnel-sep { background: var(--line); }

@media (max-width: 1100px) {
  .funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .funnel-sep { display: none; }
}
@media (max-width: 560px) {
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================= CRM · 3. Tabela densa + filtros ================= */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.filter-bar input[type="search"] { width: min(300px, 100%); }
.filter-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.fchip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.3rem 0.3rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
}
.fchip b { font-weight: 600; color: var(--muted); }
.fchip button {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.fchip button:hover { background: var(--line); color: var(--ink); }
.fchip button .icon { width: 14px; height: 14px; }
.fchip.add {
  padding: 0.3rem 0.7rem;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.fchip.add:hover { color: var(--ink); border-color: var(--brand); }

.filter-add { position: relative; }
.filter-add > summary { list-style: none; }
.filter-add > summary::-webkit-details-marker { display: none; }
.filter-pop {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 10;
  display: grid;
  gap: 0.6rem;
  width: min(300px, 80vw);
  padding: 0.85rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 15, 69, 0.08);
  border-bottom: 1px solid rgba(255, 15, 69, 0.25);
  font-size: 0.85rem;
}

.dtable-scroll { max-height: calc(100vh - 300px); min-height: 240px; overflow: auto; }
.dtable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}
.dtable th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.dtable td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover { background: var(--surface); }
.dtable tbody tr.selected { background: rgba(255, 15, 69, 0.08); }
.dtable .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dtable .muted { color: var(--muted); }
.dtable .col-check { width: 2.5rem; padding-right: 0; }
.dtable input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--brand); }

.sort {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.sort:hover { color: var(--ink); }
th[aria-sort="ascending"] .sort::after { content: "↑"; }
th[aria-sort="descending"] .sort::after { content: "↓"; }

.row-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.row-link:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .dtable .col-opt { display: none; }
}

/* ================= CRM · 4. Linha do tempo ================= */
.timeline { list-style: none; }
.tl-day {
  padding: 1rem 0 0.35rem 2.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.tl-day:first-child { padding-top: 0; }
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.6rem 0;
}
.tl-item::before {                       /* trilho vertical */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(0.75rem - 1px);
  width: 2px;
  background: var(--line);
}
.tl-dot {
  position: relative;
  z-index: 1;
  width: 0.75rem;
  height: 0.75rem;
  margin: 0.3rem auto 0;
  border-radius: 50%;
  background: var(--c, var(--muted));
  box-shadow: 0 0 0 3px var(--card);
}
.tl-title { font-size: 0.9rem; font-weight: 600; }
.tl-text { margin-top: 0.15rem; font-size: 0.84rem; color: var(--muted); }
.tl-msg {
  margin-top: 0.45rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border-left: 2px solid var(--c, var(--line-strong));
  border-radius: 0 8px 8px 0;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.tl-time { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); white-space: nowrap; }

.tl-item[data-kind="signup"]    { --c: var(--st-cadastro); }
.tl-item[data-kind="sent"]      { --c: var(--faint); }
.tl-item[data-kind="delivered"] { --c: var(--ok); }
.tl-item[data-kind="failed"],
.tl-item[data-kind="optout"]    { --c: var(--danger); }
.tl-item[data-kind="click"]     { --c: var(--info); }
.tl-item[data-kind="reply"]     { --c: var(--ink); }
.tl-item[data-kind="deposit"]   { --c: var(--st-vip); }
.tl-item[data-kind="stage"]     { --c: var(--brand-ink); }

/* ================= CRM · 5. IA ================= */
.ai-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  background: var(--accent-bg);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn.ai {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);       /* branco: 5.82:1 */
  color: #fff;
}
.btn.ai:hover:not(:disabled) { background: #7a1fd6; }
.btn.ai:disabled,
.btn.ai[aria-busy="true"] { opacity: 0.55; cursor: progress; }

.ai-box {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(139, 43, 232, 0.35);
  border-radius: var(--radius);
  background: rgba(139, 43, 232, 0.07);
}
.ai-box textarea { min-height: 72px; resize: vertical; background: var(--card); }
.ai-box-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Card de agente: <article class="card agent" data-status="idle|running|pending|error|off"> */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.agent { --c: var(--muted); display: flex; flex-direction: column; gap: 0.75rem; }
.agent[data-status="running"] { --c: var(--info); }
.agent[data-status="pending"] { --c: var(--warn); }
.agent[data-status="error"]   { --c: var(--danger); border-color: rgba(248, 113, 113, 0.4); }
.agent[data-status="off"]     { --c: var(--faint); }
.agent-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.agent-name { font-size: 1rem; font-weight: 650; letter-spacing: -0.02em; }
.agent-desc { font-size: 0.84rem; line-height: 1.4; color: var(--muted); }
.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--c);
  font-size: 0.74rem;
  font-weight: 650;
  white-space: nowrap;
}
.agent-status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}
.agent[data-status="running"] .agent-status::before { animation: crm-pulse 1.2s ease-in-out infinite; }
.agent .stats { grid-template-columns: 1fr 1fr; margin: 0; }
.agent-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; }
@keyframes crm-pulse { 50% { opacity: 0.3; } }

/* Sugestão: <article class="card suggestion" data-state="pending|approved|rejected"> */
.suggestion-list { display: grid; gap: 0.75rem; }
.suggestion { display: grid; gap: 0.65rem; border-left: 3px solid var(--warn); }
.suggestion[data-state="approved"] { border-left-color: var(--ok); }
.suggestion[data-state="rejected"] { border-left-color: var(--line-strong); }
.suggestion-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.suggestion-title { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
.suggestion-body { font-size: 0.86rem; line-height: 1.45; color: var(--muted); }
.suggestion-preview {
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.suggestion-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

/* ================= CRM · 6. Regras, stepper, checklist, prévia, templates ================= */
.rules { display: grid; gap: 0.5rem; }
.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 1.4fr) 2.25rem;
  gap: 0.5rem;
  align-items: center;
}
.rule-row select,
.rule-row input { width: 100%; }
.rule-row input[type="text"] { padding: 0.5rem 0.6rem; font-size: 0.9rem; }
.rule-row.locked {
  grid-template-columns: auto minmax(0, 1fr);
  padding: 0.55rem 0.65rem;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.rule-join {
  padding-left: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
@media (max-width: 720px) {
  .rule-row { grid-template-columns: 1fr 1fr; }
  .rule-row > :nth-child(4) { justify-self: end; }
}

/* Stepper: <ol class="stepper"><li aria-current="step"> / data-state="done|blocked" */
.stepper {
  list-style: none;
  counter-reset: step;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.stepper li {
  counter-increment: step;
  flex: 1 0 150px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--muted);
}
.stepper li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.stepper li[aria-current="step"] { border-color: var(--brand); color: var(--ink); }
.stepper li[aria-current="step"]::before { background: var(--brand-press); color: #fff; }
.stepper li[data-state="done"] { color: var(--ink); }
.stepper li[data-state="done"]::before { background: rgba(34, 197, 94, 0.16); color: var(--ok); }
.stepper li[data-state="blocked"] { border-color: rgba(248, 113, 113, 0.5); }
.stepper li[data-state="blocked"]::before { background: rgba(248, 113, 113, 0.16); color: var(--danger); }
.stepper button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Checklist de compliance (status com .pill existente) */
.checklist { list-style: none; }
.checklist li {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.checklist li:last-child { border-bottom: 0; }
.checklist .pill { justify-self: start; }
.checklist small { display: block; margin-top: 0.15rem; font-size: 0.8rem; color: var(--muted); }

/* Prévia estilo celular */
.sms-preview {
  max-width: 320px;
  padding: 1rem 0.9rem 1.2rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.sms-from { margin-bottom: 0.7rem; text-align: center; font-size: 0.72rem; color: var(--faint); }
.sms-bubble {
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border-radius: 14px 14px 14px 4px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.sms-bubble mark { background: none; color: var(--info); }

/* Templates */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.tpl-grid > .card { display: flex; flex-direction: column; gap: 0.6rem; }
.tpl-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ================= CRM · 7. Contador SMS ================= */
/* <div class="sms-meter" data-level="ok|warn|bad" data-enc="GSM-7|UCS-2"> */
.sms-meter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.sms-bar { width: 96px; height: 6px; border-radius: 999px; background: var(--line-strong); overflow: hidden; }
.sms-bar > i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: var(--ok); }
.sms-meter[data-level="warn"] .sms-bar > i { background: var(--warn); }
.sms-meter[data-level="bad"] .sms-bar > i { background: var(--danger); }
.sms-count { font-family: var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.sms-meter[data-level="bad"] .sms-count { color: var(--danger); }
.sms-enc {
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: var(--bg);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sms-meter[data-enc="UCS-2"] .sms-enc { background: rgba(253, 186, 116, 0.12); color: var(--warn); }
.sms-offenders {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  color: var(--warn);
}
.sms-offenders code {
  padding: 0 0.3rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
}

/* ================= CRM · 8. Jornada ================= */
.journey { list-style: none; max-width: 760px; }
.jstep {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: start;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.jstep[data-kind="trigger"]   { --c: var(--brand-ink); }
.jstep[data-kind="wait"]      { --c: var(--muted); }
.jstep[data-kind="message"]   { --c: var(--info); }
.jstep[data-kind="condition"] { --c: var(--warn); }
.jstep[data-kind="end"]       { --c: var(--faint); }
.jstep[aria-invalid="true"]   { border-color: var(--danger); }
.jstep-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: var(--surface);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--c);
}
.jstep-kind {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c);
}
.jstep-title { margin-top: 0.1rem; font-weight: 600; }
.jstep-sub { margin-top: 0.15rem; font-size: 0.84rem; color: var(--muted); }
.jstep-actions { display: flex; gap: 0.15rem; }
.jstep-form { grid-column: 1 / -1; padding-top: 0.75rem; border-top: 1px solid var(--line); }

.jlink { position: relative; display: grid; place-items: center; min-height: 2.75rem; padding: 0.4rem 0; }
.jlink::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--line-strong);
}
.jitem:last-child .jlink { display: none; }
.jadd {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.jadd:hover { border-color: var(--brand); color: var(--ink); }
.jadd .icon { width: 14px; height: 14px; }
.jadd-menu {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

/* ================= CRM · 9. Estados ================= */
.skeleton {
  display: block;
  height: 0.9rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--line) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: crm-shimmer 1.2s linear infinite;
}
.kpi-value .skeleton,
.funnel-value .skeleton { height: 1.4rem; width: 60%; }
@keyframes crm-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.empty-state .icon { width: 28px; height: 28px; color: var(--faint); }
.empty-state h3 { font-size: 1rem; font-weight: 650; color: var(--ink); }
.empty-state p { max-width: 42ch; font-size: 0.88rem; line-height: 1.45; }
.empty-state .btn { margin-top: 0.5rem; }

/* ================= CRM · 10. Ajustes da implementação ================= */
:root { --st-lead: #f0abfc; }
[data-stage="lead"] { --c: var(--st-lead); }

.mt { margin-top: 1rem; }
.stack-gap { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.dtable tbody tr.row-click { cursor: pointer; }
.modal-card { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.modal-card.xl { width: min(760px, 100%); }
.rule-stages { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font-size: 0.82rem; }
.rule-stages label { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.rule-stages input { accent-color: var(--brand); }
.crm-progress { width: 100%; height: 8px; margin-top: 0.6rem; accent-color: var(--brand); }
.ai-box label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.json-raw {
  max-height: 260px;
  overflow: auto;
  padding: 0.6rem;
  background: var(--bg);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.dtable td.wrap { white-space: normal; min-width: 220px; }
.sidebar .brand { padding: 0; }
.funnel > .empty-state,
.tpl-grid > .empty-state { grid-column: 1 / -1; }
/* h1 recebe foco só para o leitor de tela anunciar a troca de tela; não é controle */
h1[tabindex="-1"]:focus { outline: none; }
.section-label:has(+ .kpi-grid:empty) { display: none; }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rule-stages label { white-space: nowrap; }
div[id$="Notice"] > .note { margin: 0 0 1rem; }

/* ================= P1 · Nova arquitetura (Hoje · Funil · Campanhas · Jogadores · Disparar) ================= */
/* BG6: a sidebar nunca encolhe (3 larguras); o conteúdo nunca empurra a página para o lado */
.sidebar { flex: 0 0 var(--side-w); min-width: var(--side-w); }
@media (min-width: 900px) {
  .shell.side-collapsed .sidebar { flex-basis: var(--side-w-mini); min-width: var(--side-w-mini); }
}
@media (max-width: 899px) {
  .sidebar { min-width: 0; }
}
.main { overflow-x: clip; }
.side-nav { padding-top: 0.5rem; }

/* BG8: tabela no fluxo da página (sem rolagem vertical interna); só rola na horizontal se precisar */
.dtable-scroll { max-height: none; min-height: 0; overflow: auto hidden; }
.dtable tfoot th,
.dtable tfoot td { padding: 0.6rem 0.75rem; border-top: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; white-space: nowrap; }
.dtable tbody th[scope="row"] { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; font-weight: 500; white-space: nowrap; }
.dtable tr.partial td,
.dtable tr.partial th { color: var(--muted); }
.dtable .num .muted { color: var(--muted); }

/* BG15: botão desabilitado não parece "habilitado com erro" */
.btn.primary:disabled,
.btn.primary:disabled:hover { background: var(--surface); color: var(--faint); border-color: var(--line); opacity: 1; }

.muted { color: var(--muted); }
.small { font-size: 0.75rem; }
.good-text { color: var(--ok); }
.bad-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.note.info { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.note.info strong { color: var(--ink); }
.note .icon { width: 15px; height: 15px; vertical-align: -3px; }

/* Abas dentro de um item do menu */
.subtabs {
  display: flex;
  gap: 0.25rem;
  margin: -0.5rem 0 1.25rem;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.subtab {
  flex-shrink: 0;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.subtab:hover { color: var(--ink); }
.subtab.on { color: var(--ink); border-bottom-color: var(--brand); }

/* Hoje */
.alert-list { list-style: none; display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.alert-list:empty { display: none; }
.alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--faint);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.88rem;
}
.alert[data-level="error"] { border-left-color: var(--danger); }
.alert[data-level="warn"] { border-left-color: var(--warn); }
.alert[data-level="info"] { border-left-color: var(--info); }
.alert > .icon { color: var(--faint); }
.alert[data-level="error"] > .icon { color: var(--danger); }
.alert[data-level="warn"] > .icon { color: var(--warn); }
.alert-text { flex: 1 1 16rem; min-width: 0; }

.kpi.hero { border-color: rgba(255, 15, 69, 0.35); background: linear-gradient(180deg, rgba(255, 15, 69, 0.07), var(--card)); }
.kpi.hero .kpi-value { font-size: 2rem; }
.kpi-delta.none { color: var(--muted); font-family: var(--font); font-weight: 500; }
.kpi-sub .muted { color: var(--faint); }
.facts .kpi-value { font-size: 1.1rem; white-space: normal; }

.today-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .today-grid { grid-template-columns: 1fr 1fr; } .today-grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 720px) { .today-grid { grid-template-columns: 1fr; } }
.big-num { font-size: 2.4rem; }

.bars { margin: 0.5rem 0 0; }
.bars-svg { display: block; width: 100%; height: 170px; }
.b-signup { fill: var(--st-cadastro); }
.b-ftd { fill: var(--brand); }
.b-nodata { stroke: var(--line-strong); stroke-width: 0.5; }
.b-hatch { stroke: var(--faint); stroke-width: 1.5; }
.b-axis { stroke: var(--line-strong); stroke-width: 0.5; vector-effect: non-scaling-stroke; }
.bars-x { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin-top: 0.35rem; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); text-align: center; }
.bars-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.35rem; border-radius: 2px; vertical-align: -1px; }
.lg-signup::before { background: var(--st-cadastro); }
.lg-ftd::before { background: var(--brand); }
.lg-nodata::before { background: repeating-linear-gradient(45deg, var(--faint) 0 1.5px, transparent 1.5px 4px); border: 1px solid var(--line-strong); }
@media (max-width: 720px) { .bars-x .odd { visibility: hidden; } .bars-svg { height: 140px; } }

.src-list { list-style: none; display: grid; gap: 0.55rem; }
.src-list li { display: grid; grid-template-columns: minmax(0, 1fr) 30% auto; align-items: center; gap: 0.6rem; font-size: 0.86rem; }
.src-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-bar { height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.src-bar > i { display: block; width: var(--w); height: 100%; background: var(--st-cadastro); }
.src-num { font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; }
.stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Placar / filtros simples */
.filter-bar.plain { padding: 0.25rem 0 0.75rem; border: 0; }
.filter-bar .check { margin-top: 0; }
.filter-bar .field.inline select { padding: 0.35rem 0.5rem; }

/* Jornadas */
.journey-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .journey-grid { grid-template-columns: 1fr; } }
.card-title { font-size: 1rem; font-weight: 650; }
.journey-grid fieldset { border: 0; padding: 0; min-width: 0; }
.journey-grid legend { padding: 0; margin-bottom: 0.35rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.inline-pair { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; font-size: 0.86rem; color: var(--muted); }
.inline-pair label { display: inline-flex; align-items: center; gap: 0.4rem; }
.step-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.4rem; font-size: 0.86rem; color: var(--muted); }
.step-form label { display: inline-flex; align-items: center; gap: 0.4rem; }
.step-form input[type="number"] { width: 5.5rem; }
.step-form select { max-width: 100%; min-width: 0; }
.jstep-sub { font-size: 0.84rem; color: var(--muted); line-height: 1.4; }
.note.small { font-size: 0.78rem; padding: 0.4rem 0.6rem; }

/* Ficha: ações raras recolhidas */
details.card.fold > summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.75rem; list-style: none; cursor: pointer; }
details.card.fold > summary::-webkit-details-marker { display: none; }
details.card.fold > summary h2 { font-size: 1rem; font-weight: 650; }
details.card.fold > summary h2::before { content: "▸ "; color: var(--faint); }
details.card.fold[open] > summary h2::before { content: "▾ "; }
details.card.fold > summary .status { margin: 0; }

@media (max-width: 899px) {
  .page-head { flex-wrap: wrap; }
  .page-actions { flex-wrap: wrap; }
  .kpi.hero .kpi-value { font-size: 1.6rem; }
}
#tdKpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { #tdKpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dtable tbody th[scope="row"],
.dtable tfoot th[scope="row"] {
  position: static;
  background: none;
  font-family: var(--font);
  font-size: 0.86rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.dtable tfoot th[scope="row"] { background: var(--surface); font-weight: 650; }
.dtable tbody th[scope="row"] .row-link { white-space: nowrap; }
.dtable.wrap-head thead th { white-space: normal; vertical-align: bottom; min-width: 4.5rem; }
.dtable.wrap-head tbody th[scope="row"] { white-space: normal; min-width: 14rem; }
.dtable.wrap-head tbody th[scope="row"] .row-link { white-space: normal; }
/* a coluna da sidebar continua até o fim de páginas longas (a sidebar é sticky com 100vh) */
@media (min-width: 900px) {
  .app.shell { background: linear-gradient(90deg, var(--card) calc(var(--side-w) - 1px), var(--line) 0 var(--side-w), transparent 0); }
  .app.shell.side-collapsed { background: linear-gradient(90deg, var(--card) calc(var(--side-w-mini) - 1px), var(--line) 0 var(--side-w-mini), transparent 0); }
}
@media (max-width: 960px) {
  .data-row { grid-template-columns: minmax(0, 1fr) auto; }
  .data-row > * { min-width: 0; }
  .data-row > :last-child { grid-column: 2; grid-row: 1; align-self: start; }
}
@media (max-width: 560px) {
  .kpi-value, .kpi.hero .kpi-value { font-size: 1.3rem; }
  .bars-x { font-size: 0.62rem; }
}
@media (max-width: 720px) { .dtable .col-m { display: none; } }
@media (max-width: 960px) { .journey-grid { grid-template-columns: minmax(0, 1fr); } }
.filter-count { min-width: 0; text-align: right; }
@media (max-width: 720px) {
  .filter-bar .filter-count { margin-left: 0; text-align: left; flex-basis: 100%; }
  /* placar no celular: campanha, enviados, entrega, FTD influenciado e custo/FTD */
  .sc-table tr > :nth-child(4),
  .sc-table tr > :nth-child(5),
  .sc-table tr > :nth-child(7),
  .sc-table tr > :nth-child(8),
  .sc-table tr > :nth-child(10) { display: none; }
  .dtable.wrap-head tbody th[scope="row"] { min-width: 9rem; }
}
#jeDetail .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
@media (min-width: 1100px) { #jeDetail .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ================= CRM v2 · tokens (02-ia-wireframes §5.1) — componentes em v2/v2.css ================= */
:root {
  /* camadas */
  --topbar-h: 52px;
  --z-sidebar: 20; --z-topbar: 30; --z-sticky: 25; --z-drawer: 40; --z-dialog: 50; --z-toast: 60; --z-palette: 70;
  /* densidade */
  --row-h: 40px; --row-h-compact: 32px; --cell-px: 12px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  /* tipo */
  --fs-xs: 0.6875rem; --fs-sm: 0.8125rem; --fs-md: 0.875rem; --fs-lg: 1rem; --fs-h2: 1.125rem; --fs-h1: 1.5rem; --fs-kpi: 1.75rem;
  /* fundos de status (10–14% da cor) */
  --ok-bg: rgba(34, 197, 94, 0.12); --danger-bg: rgba(248, 113, 113, 0.12);
  --warn-bg: rgba(253, 186, 116, 0.12); --info-bg: rgba(125, 211, 252, 0.12);
  /* estágios que faltam */
  --st-lead: #8a8a93; /* §5.1 pedia #71717a (3,9:1 no chip); cinza AA */ --st-optout: #f87171;
  /* foco */
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
}
[data-stage="optout"] { --c: var(--st-optout); }
/* §5.2: números em Inter tabular; mono só em .mono (telefone, tag, ID) */
.num, .dtable .num { font-family: var(--font); font-variant-numeric: tabular-nums; }
