/* ════════════════════════════════════════════════════════════════
   UTMize — design system
   Precisão operacional: rail de comando escuro + canvas claro.
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Neutros quentes — design system GL Suite */
  --ink:      #0a0a0f;
  --ink-2:    #2a2a33;
  --muted:    #6b6b75;
  --faint:    #a8a8b0;
  --line:     #ecebe5;
  --line-2:   #f2f1ec;
  --bg:       #f5f4ef;
  --card:     #ffffff;

  /* Rail (preto-quase GL Suite) */
  --rail:       #0a0a0f;
  --rail-2:     #17171d;
  --rail-line:  rgba(255,255,255,.08);
  --rail-text:  #a8a8b0;
  --rail-dim:   #6b6b75;

  /* Marca — azul elétrico GL Suite */
  --brand:      #0014ff;
  --brand-ink:  #0010cc;
  --brand-lite: #6a80ff;
  --brand-soft: #ecedfe;
  --brand-glow: rgba(0,20,255,.18);

  /* Sinais */
  --pos:        #059669;
  --pos-soft:   #e3f4ee;
  --warn:       #d97706;
  --warn-soft:  #fbeedb;
  --neg:        #dc2626;
  --neg-soft:   #fbe6e6;

  /* Paleta de dados GL Suite */
  --viz-1: #0014ff;
  --viz-2: #059669;
  --viz-3: #f97316;
  --viz-4: #8b5cf6;
  --viz-5: #f43f5e;
  --viz-6: #06b6d4;

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(10,10,15,.05);
  --shadow:    0 2px 4px rgba(10,10,15,.04), 0 10px 26px -10px rgba(10,10,15,.14);
  --shadow-lg: 0 24px 60px -16px rgba(10,10,15,.26);

  --display: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --body:    'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

::selection { background: var(--brand); color: #fff; }

/* Scrollbar discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4cd; border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #bdbdb5; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ════════════ APP SHELL ════════════ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 26px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: block; padding: 2px 10px 26px; }
.brand-logo { height: 27px; width: auto; display: block; }
.brand-by {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--faint);
  margin-top: 9px; display: block;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint);
  padding: 0 12px; margin-bottom: 11px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .14s, color .14s, border-color .14s, box-shadow .14s;
}
.nav-num {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--faint); width: 15px; flex-shrink: 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .55; }
.nav-text { flex: 1; }
.nav-item:hover { background: rgba(10,10,15,.04); color: var(--ink); }
.nav-item.is-active {
  background: var(--card); color: var(--ink);
  border-color: var(--line); box-shadow: var(--shadow-sm); font-weight: 600;
}
.nav-item.is-active .nav-num { color: var(--brand); }
.nav-item.is-active svg { opacity: 1; color: var(--brand); }

.sidebar-foot { padding-top: 14px; }
.db-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--card); border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.db-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--faint);
  flex-shrink: 0;
}
.db-pill.is-local .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.db-pill.is-supabase .dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.sidebar-credit {
  font-family: var(--mono); font-size: 9.5px; color: var(--faint);
  margin-top: 11px; text-align: center; letter-spacing: .08em;
}

/* ════════════ CANVAS ════════════ */
.canvas {
  flex: 1; min-width: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(10,10,15,.05) 1px, transparent 1.4px);
  background-size: 26px 26px;
  padding: 30px 36px 60px;
}
.wrap { max-width: 1240px; margin: 0 auto; }

.view-enter { animation: viewIn .32s cubic-bezier(.2,.7,.3,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stagger > * { opacity: 0; animation: viewIn .4s cubic-bezier(.2,.7,.3,1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }

/* ════════════ PAGE HEAD ════════════ */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 30px; flex-wrap: wrap;
}
.page-head .titles { min-width: 0; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 13px; display: flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: "§"; color: var(--brand); font-size: 13px; font-weight: 700; }
h1.page-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(30px, 3.8vw, 46px);
  letter-spacing: -.04em; line-height: 1.0; color: var(--ink);
}
.page-sub { font-size: 14.5px; color: var(--muted); margin-top: 11px; max-width: 62ch; }
.page-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* ════════════ BOTÕES ════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; line-height: 1;
  padding: 11px 19px; border-radius: 999px;
  border: 1px solid transparent; background: var(--card);
  transition: background .14s, border-color .14s, color .14s, transform .08s, box-shadow .14s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px var(--brand-glow); }
.btn.primary:hover { background: var(--brand-ink); }
.btn.primary:disabled { background: #c8c8ce; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; }
.btn.danger { background: var(--card); border-color: var(--line); color: var(--neg); }
.btn.danger:hover { background: var(--neg-soft); border-color: var(--neg); }
.btn.sm { padding: 8px 13px; font-size: 12.5px; gap: 5px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; pointer-events: none; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 999px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: .14s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn.danger:hover { border-color: var(--neg); color: var(--neg); background: var(--neg-soft); }

/* ════════════ CARDS ════════════ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: none;
}
.card-pad { padding: 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 17px 22px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 {
  font-family: var(--display); font-size: 15.5px; font-weight: 700;
  letter-spacing: -.01em;
}
.card-head .sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }

/* ════════════ MÉTRICAS (KPI) ════════════ */
.kpi {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 19px; position: relative;
  overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kpi:hover { border-color: #d8d8d2; box-shadow: var(--shadow); }
.kpi-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--faint);
  display: flex; align-items: center; gap: 6px;
}
.kpi-label svg { width: 14px; height: 14px; }
.kpi-value {
  font-family: var(--display); font-size: 34px; font-weight: 800;
  letter-spacing: -.035em; line-height: 1; margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: 17px; color: var(--faint); font-weight: 700; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.kpi-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--pos); }
.delta.down { color: var(--neg); }

/* ════════════ FORMULÁRIOS ════════════ */
.field { display: flex; flex-direction: column; margin-bottom: 15px; }
.field label, .form-label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px;
}
.field .req { color: var(--brand); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 15px; }

input[type=text], input[type=url], input[type=email], input[type=number],
input[type=search], input[type=date], input:not([type]), textarea, select {
  font-size: 13.5px; color: var(--ink); width: 100%;
  background: #fbfbf9; border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
textarea { resize: vertical; min-height: 84px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2362657a' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3.5px var(--brand-soft);
}
input::placeholder, textarea::placeholder { color: #b6b7c0; }
.field .hint { font-size: 11.5px; color: var(--faint); margin-top: 5px; }
.field.invalid input, input.invalid { border-color: var(--neg); box-shadow: 0 0 0 3.5px var(--neg-soft); }

/* Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cfcfca; border-radius: 99px; cursor: pointer; transition: .18s; }
.slider::before {
  content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(17px); }
.toggle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
}
.toggle-row .tt { flex: 1; }
.toggle-row strong { font-size: 13px; font-weight: 600; }
.toggle-row span { font-size: 12px; color: var(--muted); }
.toggle-row code { font-family: var(--mono); font-size: 11px; background: var(--brand-soft); color: var(--brand); padding: 1px 5px; border-radius: 4px; }

/* Period selector */
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; font-size: 12.5px; font-weight: 600;
  color: var(--muted); padding: 6px 13px; border-radius: 999px; transition: .13s;
}
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--ink); color: #fff; }

/* ════════════ URL TERMINAL (assinatura) ════════════ */
.url-term {
  background: var(--rail); border-radius: var(--r);
  padding: 17px 19px; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.85; word-break: break-all; min-height: 84px;
  display: flex; align-items: center; position: relative;
}
.url-term .placeholder { color: #5b5d68; font-family: var(--body); font-size: 13px; }
.u-base { color: #c9cad2; }
.u-sep  { color: #5b5d68; }
.u-key  { color: var(--brand-lite); font-weight: 600; }
.u-utm  { color: #34d399; font-weight: 600; }
.u-val  { color: #fff; }
.u-frag { color: #fb923c; }
.u-ucid { color: #fb923c; }

/* ════════════ CHECKS ════════════ */
.checks { display: flex; flex-direction: column; gap: 7px; }
.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; line-height: 1.5; padding: 9px 12px; border-radius: var(--r-sm);
}
.check .ico {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff;
  margin-top: 1px;
}
.check.ok  { background: var(--pos-soft); color: #0a6f49; }
.check.ok .ico  { background: var(--pos); }
.check.warn { background: var(--warn-soft); color: #87530a; }
.check.warn .ico { background: var(--warn); }
.check.err { background: var(--neg-soft); color: #a01428; }
.check.err .ico { background: var(--neg); }
.check b { font-weight: 700; }

/* ════════════ BADGES ════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap;
}
.badge.mono { font-family: var(--mono); font-weight: 600; text-transform: lowercase; }
.badge.gray { background: var(--line-2); color: var(--muted); }
.badge.pos { background: var(--pos-soft); color: #0a6f49; }
.badge.warn { background: var(--warn-soft); color: #87530a; }
.badge.neg { background: var(--neg-soft); color: #a01428; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { background: var(--pos-soft); color: #0a6f49; }
.status-paused { background: var(--warn-soft); color: #87530a; }
.status-ended  { background: var(--line-2); color: var(--muted); }
.status-draft  { background: var(--brand-soft); color: var(--brand); }

/* ════════════ TABELAS ════════════ */
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); text-align: left; padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td {
  padding: 13px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px;
  vertical-align: middle;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafaf8; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .strong { font-weight: 600; }
.t-bar {
  height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; min-width: 56px;
}
.t-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* ════════════ LISTAS / CARDS DE ITENS ════════════ */
.row-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 18px; transition: border-color .14s, box-shadow .14s, transform .12s;
}
.row-card:hover { border-color: #d8d8d2; box-shadow: var(--shadow); }
.row-card .grow { flex: 1; min-width: 0; }
.mono-url {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Cartão-tile (campanhas) */
.card.tile { display: block; overflow: hidden; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s; }
.card.tile:hover { border-color: #d3d3cc; box-shadow: var(--shadow); transform: translateY(-2px); }
.cc-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-2); }
.cc-stat { padding: 11px 13px; border-right: 1px solid var(--line-2); }
.cc-stat:last-child { border-right: 0; }
.cc-stat-l { font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--faint); }
.cc-stat-v { font-family: var(--display); font-weight: 800; font-size: 17px;
  margin-top: 3px; letter-spacing: -.02em; }

/* ════════════ KANBAN ════════════ */
.kanban { display: flex; gap: 13px; overflow-x: auto; padding-bottom: 12px; }
.kcol {
  flex: 1; min-width: 224px; background: rgba(255,255,255,.55);
  border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column;
  max-height: calc(100vh - 230px);
}
.kcol.drop-on { border-color: var(--brand); background: var(--brand-soft); }
.kcol-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--line-2); position: sticky; top: 0;
}
.kcol-head .kdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kcol-head .kname { font-weight: 700; font-size: 12.5px; text-transform: capitalize; }
.kcol-head .kcount {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--line-2); padding: 2px 7px; border-radius: 99px; font-variant-numeric: tabular-nums;
}
.kcol-head .kvalue { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.kcol-body { padding: 9px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.kcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 12px; cursor: grab; transition: box-shadow .13s, border-color .13s, transform .08s;
}
.kcard:hover { box-shadow: var(--shadow); border-color: #d6d6d0; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }
.kcard .kc-name { font-weight: 600; font-size: 13px; }
.kcard .kc-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }
.kcard .kc-tags { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.kcard .kc-val { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--pos); }

/* ════════════ INSIGHTS ════════════ */
.insight {
  display: flex; gap: 13px; padding: 16px 17px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  border-left-width: 3px;
}
.insight.good { border-left-color: var(--pos); }
.insight.warn { border-left-color: var(--warn); }
.insight.bad  { border-left-color: var(--neg); }
.insight.info { border-left-color: var(--brand); }
.insight-ico {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex-shrink: 0;
  display: grid; place-items: center;
}
.insight.good .insight-ico { background: var(--pos-soft); color: var(--pos); }
.insight.warn .insight-ico { background: var(--warn-soft); color: var(--warn); }
.insight.bad  .insight-ico { background: var(--neg-soft); color: var(--neg); }
.insight.info .insight-ico { background: var(--brand-soft); color: var(--brand); }
.insight-ico svg { width: 18px; height: 18px; }
.insight h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 3px; }
.insight p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.insight .area {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); margin-top: 7px; display: inline-block;
}

/* ════════════ CHARTS ════════════ */
.chart-svg { display: block; width: 100%; overflow: visible; }
.chart-grid line { stroke: var(--line-2); stroke-width: 1; }
.chart-axis { fill: var(--faint); font-size: 10px; font-family: var(--mono); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-item .sw { width: 10px; height: 10px; border-radius: 3px; }

.funnel-step { display: flex; align-items: center; gap: 14px; }
.funnel-bar-wrap { flex: 1; }
.funnel-bar {
  height: 38px; border-radius: var(--r-sm); display: flex; align-items: center;
  padding: 0 14px; color: #fff; font-weight: 700; font-size: 13px;
  transition: width .5s cubic-bezier(.2,.7,.3,1);
}
.funnel-meta { width: 132px; flex-shrink: 0; }
.funnel-meta .fl { font-size: 12.5px; font-weight: 600; }
.funnel-meta .fr { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ════════════ EMPTY / LOADING ════════════ */
.empty {
  text-align: center; padding: 56px 24px; color: var(--faint);
}
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 14px; }
.empty h3 { font-family: var(--display); font-size: 17px; color: var(--muted); margin-bottom: 5px; }
.empty p { font-size: 13px; max-width: 38ch; margin: 0 auto 16px; }

.skeleton {
  background: linear-gradient(100deg, var(--line-2) 30%, #f7f7f4 50%, var(--line-2) 70%);
  background-size: 220% 100%; animation: sk 1.3s linear infinite; border-radius: var(--r-sm);
}
@keyframes sk { from { background-position: 200% 0; } to { background-position: -40% 0; } }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════ MODAL ════════════ */
.modal-layer {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,10,15,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
  animation: fade .16s ease;
}
.modal-layer[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 88vh; display: flex; flex-direction: column;
  animation: modalIn .22s cubic-bezier(.2,.8,.3,1);
}
.modal.wide { max-width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 19px 22px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-family: var(--display); font-size: 17px; font-weight: 700; }
.modal-head .sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 16px 22px; border-top: 1px solid var(--line-2);
}

/* ════════════ TOAST ════════════ */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(22px);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 12px 20px; border-radius: var(--r); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .24s cubic-bezier(.2,.8,.3,1); z-index: 200;
  display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .tico { width: 18px; height: 18px; }
.toast.ok { background: var(--pos); }
.toast.err { background: var(--neg); }

/* ════════════ MISC ════════════ */
.section-title {
  font-family: var(--display); font-size: 16px; font-weight: 700;
  letter-spacing: -.01em; margin-bottom: 13px; display: flex; align-items: center; gap: 9px;
}
.section-title .count { font-size: 12px; font-weight: 700; color: var(--faint); }
.divider { height: 1px; background: var(--line-2); margin: 22px 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex.between { justify-content: space-between; }
.flex.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.copy-chip {
  font-family: var(--mono); font-size: 11.5px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px;
  display: flex; align-items: center; gap: 10px;
}
.copy-chip .ct { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-box {
  display: flex; gap: 16px; align-items: center; padding: 16px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
}
.qr-box img { border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; }

/* ════════════ ONBOARDING ════════════ */
.onb-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px 26px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.onb-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-lite));
}
.onb-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 16px; }
.onb-eyebrow {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px;
}
.onb-head h3 { font-family: var(--display); font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.onb-head p { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 52ch; }
.onb-ring { flex-shrink: 0; }
.onb-steps { display: flex; flex-direction: column; gap: 8px; }
.onb-step {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .14s, background .14s;
}
.onb-step.done { background: var(--bg); border-color: var(--line-2); }
.onb-step-mark {
  width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 14px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.onb-step.done .onb-step-mark { background: var(--pos); color: #fff; border-color: var(--pos); }
.onb-step.done .onb-step-mark svg { width: 15px; height: 15px; }
.onb-step-body { flex: 1; min-width: 0; }
.onb-step-body strong { font-size: 13.5px; font-weight: 600; display: block; }
.onb-step.done .onb-step-body strong { color: var(--muted); }
.onb-step-body span { font-size: 12px; color: var(--muted); }
.onb-step-tag {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--pos);
  text-transform: uppercase; letter-spacing: .06em; flex-shrink: 0;
}
.onb-dismiss {
  background: none; border: 0; color: var(--faint); font-size: 12.5px;
  font-weight: 600; margin-top: 13px; padding: 4px 2px;
}
.onb-dismiss:hover { color: var(--ink-2); }
.onb-done { display: flex; align-items: center; gap: 16px; }
.onb-done::before { background: var(--pos); }
.onb-done-ico { font-size: 30px; flex-shrink: 0; }
.onb-done h3 { font-family: var(--display); font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.onb-done p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Tour guiado */
.tour-layer { position: fixed; inset: 0; z-index: 150; }
.tour-spot {
  position: absolute; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(10,10,15,.55);
  border: 2px solid var(--brand-lite); pointer-events: none;
  transition: top .25s, left .25s, width .25s, height .25s;
}
.tour-pop {
  position: absolute; width: 312px; max-width: calc(100vw - 32px);
  background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 20px; animation: viewIn .24s ease;
}
.tour-step-n {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 8px;
}
.tour-pop h4 { font-family: var(--display); font-size: 18px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.tour-pop p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; gap: 12px; }
.tour-dots { display: flex; gap: 5px; }
.tour-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--line); transition: .2s; }
.tour-dot.on { background: var(--brand); width: 16px; }
.tour-actions { display: flex; gap: 7px; }

/* Rótulo técnico (chip ao lado do label amigável) */
.code-tag {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  padding: 1.5px 6px; border-radius: 5px; letter-spacing: 0; vertical-align: middle;
}

/* Tooltip de ajuda */
.infotip { position: relative; display: inline-flex; vertical-align: middle; }
.infotip-ico {
  width: 15px; height: 15px; border-radius: 999px; cursor: help;
  background: var(--line); color: var(--muted);
  display: grid; place-items: center; font-size: 10px; font-weight: 800; font-style: normal;
}
.infotip-ico:hover { background: var(--brand); color: #fff; }
.infotip-bubble {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 218px; background: var(--ink); color: #fff;
  font-size: 11.5px; line-height: 1.5; font-weight: 400;
  font-family: var(--body); text-transform: none; letter-spacing: normal;
  text-align: left; padding: 9px 11px; border-radius: 9px; z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .14s;
}
.infotip:hover .infotip-bubble { opacity: 1; }

/* Expander de opções avançadas */
.adv-toggle {
  background: none; border: 0; color: var(--brand); font-size: 12.5px;
  font-weight: 600; display: flex; align-items: center; gap: 6px; padding: 8px 0 2px;
}
.adv-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.adv-toggle.open svg { transform: rotate(180deg); }
.adv-body[hidden] { display: none; }
.adv-body { margin-top: 12px; }

/* ════════════ TELA DE LOGIN ════════════ */
.auth-screen {
  position: fixed; inset: 0; z-index: 120;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(10,10,15,.05) 1px, transparent 1.4px);
  background-size: 26px 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 392px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 36px 34px;
  box-shadow: var(--shadow); animation: viewIn .3s ease;
}
.auth-logo { height: 30px; width: auto; display: block; margin-bottom: 24px; }
.auth-card h1 {
  font-family: var(--display); font-size: 25px; font-weight: 800; letter-spacing: -.03em;
}
.auth-sub { font-size: 13.5px; color: var(--muted); margin: 6px 0 22px; }
.auth-card form .field { margin-bottom: 14px; }
.auth-error {
  background: var(--neg-soft); color: #a01428; font-size: 12.5px; font-weight: 600;
  padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 14px;
}
.auth-card .btn.block { margin-top: 4px; }
.auth-foot {
  font-size: 12.5px; color: var(--muted); text-align: center;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2);
}
.auth-foot a { color: var(--brand); font-weight: 600; }
.auth-credit {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  letter-spacing: .1em; text-transform: uppercase;
}

/* Cartão de usuário no sidebar */
.user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; margin-bottom: 9px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 13px;
}
.user-meta { flex: 1; min-width: 0; line-height: 1.25; }
.user-meta strong {
  font-size: 12px; font-weight: 600; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-meta span { font-size: 10px; color: var(--faint); }

/* ════════════ RESPONSIVO ════════════ */
@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px;
  }
  .brand { padding: 0; flex-shrink: 0; }
  .brand-by { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav-label { display: none; }
  .nav-num, .nav-text { display: none; }
  .nav-item { padding: 9px; }
  .sidebar-foot { display: none; }
  .canvas { padding: 22px 16px 48px; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .onb-step { flex-wrap: wrap; }
  .onb-step .btn { width: 100%; }
  .tour-pop { width: calc(100vw - 32px); }
}
