/* ==========================================================================
   MarketReviser — sistema visual
   Tema base (dark/midnight) + troca completa de paleta via CSS variables
   ========================================================================== */

:root {
  --bg: #0b0f1a;
  --bg-soft: #0f1524;
  --surface: #131a2b;
  --surface-2: #182238;
  --surface-3: #1e2a44;
  --border: #24304b;
  --border-soft: #1b2438;
  --text: #e8edf7;
  --text-dim: #9aa8c2;
  --text-mute: #6b7c9b;
  --primary: #6366f1;
  --primary-dim: #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.14);
  --accent: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.65);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --sidebar-w: 254px;
  --gap: 18px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

/* ---------- Densidade compacta ---------- */
[data-density='compact'] {
  --gap: 12px;
  --radius: 11px;
  --sidebar-w: 226px;
}

/* ---------- Temas prontos ---------- */
[data-theme='graphite'] {
  --bg: #101112; --bg-soft: #151617; --surface: #1a1c1e; --surface-2: #212427;
  --surface-3: #2a2e32; --border: #33383d; --border-soft: #262a2e;
  --text: #f0f2f4; --text-dim: #a8b0b8; --text-mute: #767f88;
}
[data-theme='ocean'] {
  --bg: #04121f; --bg-soft: #061725; --surface: #0a2136; --surface-2: #0e2a44;
  --surface-3: #123552; --border: #1a4363; --border-soft: #0f2b44;
  --text: #dff0fb; --text-dim: #8fb4cc; --text-mute: #63849b;
}
[data-theme='plum'] {
  --bg: #12091a; --bg-soft: #180d22; --surface: #20122c; --surface-2: #2a1839;
  --surface-3: #351f47; --border: #432a58; --border-soft: #301c42;
  --text: #f2e9fa; --text-dim: #b79ccb; --text-mute: #8a6fa3;
}
[data-theme='light'] {
  --bg: #f4f6fb; --bg-soft: #eef1f8; --surface: #ffffff; --surface-2: #f7f9fc;
  --surface-3: #eef2f9; --border: #dde4ee; --border-soft: #e8edf5;
  --text: #16202f; --text-dim: #5a6a80; --text-mute: #8394a8;
  --shadow-sm: 0 1px 2px rgba(16, 32, 64, 0.06);
  --shadow: 0 10px 26px -10px rgba(16, 32, 64, 0.18);
  --shadow-lg: 0 30px 70px -20px rgba(16, 32, 64, 0.28);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#root { height: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border); background-clip: content-box; }

/* ---------- boot ---------- */
.boot { height: 100%; display: grid; place-content: center; gap: 16px; justify-items: center; }
.boot-logo {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  font-weight: 800; font-size: 24px; color: #fff; box-shadow: var(--shadow);
  animation: pulse 1.6s ease-in-out infinite;
}
.boot-text { color: var(--text-mute); font-size: 13px; letter-spacing: 0.04em; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: 0.8; } }

/* ---------- layout ---------- */
.app { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto; background: var(--bg-soft);
  border-right: 1px solid var(--border-soft); display: flex; flex-direction: column;
  transition: width 0.18s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px 14px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  color: #fff; font-weight: 800; font-size: 17px; flex: 0 0 auto;
}
.brand-name { font-weight: 700; letter-spacing: -0.02em; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: var(--text-mute); letter-spacing: 0.1em; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-mute); padding: 14px 10px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; font-size: 13.5px; position: relative; width: 100%; text-align: left;
  transition: background 0.13s ease, color 0.13s ease;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--text); }
.nav-item.nav-sub { padding-left: 26px; font-size: 12.5px; opacity: 0.92; }
.nav-item.nav-sub.active::before { left: -10px; }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 4px 4px 0; background: var(--primary);
}
.nav-item .ico { width: 18px; height: 18px; flex: 0 0 auto; opacity: 0.9; }
.nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: var(--danger); color: #fff; min-width: 18px; text-align: center;
}
.nav-badge.soft { background: var(--surface-3); color: var(--text-dim); }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); width: 100%; text-align: left; }
.user-chip:hover { background: var(--surface); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  font-weight: 700; font-size: 12.5px; color: #fff;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mail { font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; border-bottom: 1px solid var(--border-soft); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 16.5px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.topbar .crumb { font-size: 12px; color: var(--text-mute); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.view { flex: 1; overflow-y: auto; padding: 22px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  font-weight: 600; font-size: 13px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: all 0.13s ease; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-mute); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-dim));
  border-color: transparent; color: #fff; box-shadow: 0 4px 14px -4px var(--primary);
}
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-success { background: var(--success); border-color: transparent; color: #06210f; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft);
}
.card-title { font-weight: 650; font-size: 14px; }
.card-sub { font-size: 12px; color: var(--text-mute); }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }

/* ---------- KPI ---------- */
.kpi { padding: 15px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.kpi-ico {
  position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
}
.kpi { position: relative; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px; background: var(--bg-soft);
  border: 1px solid var(--border); outline: none; transition: border 0.13s ease, box-shadow 0.13s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { resize: vertical; min-height: 84px; }
.select { 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='%236b7c9b' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.check input { accent-color: var(--primary); width: 15px; height: 15px; }
input[type='range'] { accent-color: var(--primary); }

.search-input { position: relative; }
.search-input .input { padding-left: 34px; }
.search-input svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }

/* ---------- tabela ---------- */
.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-mute); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1; white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-dim);
}
.badge.alto { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.badge.relevante { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
.badge.medio { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge.baixo { background: rgba(249, 115, 22, 0.16); color: #fb923c; }
.badge.zero { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }
.badge.ok { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
.badge.warn { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.badge.err { background: rgba(239, 68, 68, 0.14); color: #f87171; }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px;
  color: var(--text-dim); font-weight: 550; transition: all 0.12s ease;
}
.chip:hover { border-color: var(--text-mute); color: var(--text); }
.chips .chip.on,
.chip.on {
  background: var(--primary-soft) !important;
  border-color: var(--primary) !important;
  color: var(--text) !important;
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--primary);
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- score ring ---------- */
.score { display: inline-flex; align-items: center; gap: 8px; }
.score-dot { width: 8px; height: 8px; border-radius: 50%; }
.score-num { font-weight: 750; font-variant-numeric: tabular-nums; }
.score-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.score-bar > i { display: block; height: 100%; border-radius: 4px; }

/* ---------- login ---------- */
.login-wrap {
  height: 100%; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--bg);
}
.login-hero {
  position: relative; padding: 52px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 520px at 12% 8%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 62%),
    radial-gradient(700px 520px at 86% 92%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    linear-gradient(160deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--border-soft); overflow: hidden;
}
.login-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 46px 46px; opacity: 0.35; mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-title { font-size: 40px; line-height: 1.08; font-weight: 780; letter-spacing: -0.035em; margin: 0 0 16px; max-width: 560px; }
.login-title span { background: linear-gradient(100deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-desc { color: var(--text-dim); font-size: 15px; max-width: 480px; }
.login-feats { display: grid; gap: 12px; margin-top: 30px; max-width: 500px; }
.login-feat { display: flex; gap: 12px; align-items: flex-start; }
.login-feat .dot {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700;
}
.login-feat b { font-size: 13.5px; }
.login-feat p { margin: 1px 0 0; font-size: 12.5px; color: var(--text-mute); }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 384px; }
.login-card h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
.login-card .muted { color: var(--text-mute); font-size: 13px; margin-bottom: 22px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.alert.err { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.28); }
.alert.info { background: var(--primary-soft); color: var(--text-dim); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); }
@media (max-width: 980px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }

/* ---------- progresso / pesquisa ---------- */
.research-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--gap); height: calc(100vh - 62px - 44px); }
@media (max-width: 1180px) { .research-grid { grid-template-columns: 1fr; height: auto; } }

.progress-shell { padding: 14px 18px; }
.progress-top { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.progress-track { height: 7px; border-radius: 8px; background: var(--surface-3); overflow: hidden; position: relative; }
.progress-fill {
  height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.progress-steps { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pstep { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-mute); padding: 3px 9px; border-radius: 20px; background: var(--bg-soft); }
.pstep.active { color: var(--text); background: var(--primary-soft); }
.pstep.done { color: var(--success); }
.pstep i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.map-pane { position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.map-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); flex: 0 0 auto; }
.map-canvas { height: 46%; min-height: 220px; flex: 0 0 auto; background: var(--bg-soft); }
.map-list { flex: 1; overflow-y: auto; min-height: 0; }
.map-list-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: background 0.12s; }
.map-list-item:hover { background: var(--surface-2); }
.map-list-item.active { background: var(--primary-soft); }
.map-list-item .pin {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--surface-3); font-size: 14px;
}
.map-list-item h4 { margin: 0; font-size: 13.5px; font-weight: 620; }
.map-list-item .meta { font-size: 11.5px; color: var(--text-mute); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.leaflet-container { background: var(--bg-soft) !important; font-family: var(--font) !important; }
.leaflet-control-attribution { background: rgba(0,0,0,0.5) !important; color: #9aa8c2 !important; font-size: 9.5px !important; }
.leaflet-control-attribution a { color: #38bdf8 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; }
.leaflet-popup-content { font-size: 12.5px; margin: 10px 12px; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }

.rec-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.rec-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.rec-card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface-2); padding: 13px; transition: border-color 0.14s; }
.rec-card:hover { border-color: var(--border); }
.rec-card.rank1 { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 20%, transparent); }
.rec-top { display: flex; gap: 10px; align-items: flex-start; }
.rec-name { font-weight: 650; font-size: 14px; }
.rec-sub { font-size: 11.5px; color: var(--text-mute); }
.rec-ring {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  font-weight: 780; font-size: 14px; position: relative;
}
.rec-why { font-size: 12.5px; color: var(--text-dim); margin-top: 9px; line-height: 1.55; white-space: pre-wrap; }
.rec-findings { margin-top: 9px; display: flex; flex-direction: column; gap: 4px; }
.finding { display: flex; gap: 7px; font-size: 12px; color: var(--text-dim); align-items: flex-start; }
.finding .mark { font-weight: 800; font-size: 10px; margin-top: 3px; flex: 0 0 auto; }
.finding.critico .mark { color: var(--danger); }
.finding.alerta .mark { color: var(--warning); }
.finding.ok .mark { color: var(--success); }
.finding.info .mark { color: var(--text-mute); }
.rec-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.tier-group { display: flex; flex-direction: column; gap: 8px; }
.tier-heading { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-mute); margin-top: 6px; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 13px; height: 100%; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kcol { width: 292px; flex: 0 0 auto; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 100%; }
.kcol-head { padding: 11px 13px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border-soft); }
.kcol-dot { width: 8px; height: 8px; border-radius: 50%; }
.kcol-name { font-weight: 650; font-size: 13px; }
.kcol-count { font-size: 11px; color: var(--text-mute); background: var(--surface-3); padding: 0 7px; border-radius: 20px; }
.kcol-total { margin-left: auto; font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.kcol-body { padding: 9px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 100px; flex: 1; }
.kcol.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.kcard {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 11px; padding: 11px;
  cursor: grab; transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.kcard:hover { border-color: var(--border); transform: translateY(-1px); box-shadow: var(--shadow); }
.kcard.dragging { opacity: 0.45; transform: rotate(1.5deg) scale(0.99); }
.kcard-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.kcard-client { font-size: 11.5px; color: var(--text-mute); }
.kcard-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.kcard-value { font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.kcard-icons { margin-left: auto; display: flex; gap: 7px; font-size: 10.5px; color: var(--text-mute); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 6, 14, 0.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 900; padding: 24px; animation: fade 0.14s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; max-height: 90vh;
  display: flex; flex-direction: column; animation: pop 0.17s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal.wide { max-width: 940px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { margin: 0; font-size: 16.5px; letter-spacing: -0.015em; }
.modal-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-mute); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border-soft); display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }
.tabs { display: flex; gap: 3px; padding: 0 20px; border-bottom: 1px solid var(--border-soft); }
.tab { padding: 11px 13px; font-size: 13px; font-weight: 600; color: var(--text-mute); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-color: var(--primary); }

/* ---------- misc ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.mt { margin-top: var(--gap); }
.mt-s { margin-top: 10px; }
.mb { margin-bottom: var(--gap); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.empty { padding: 44px 20px; text-align: center; color: var(--text-mute); }
.empty .big { font-size: 30px; margin-bottom: 10px; opacity: 0.55; }
.divider { height: 1px; background: var(--border-soft); margin: 14px 0; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-mute); font-size: 12.5px; }
.kv dd { margin: 0; }
.pill-tabs { display: inline-flex; background: var(--bg-soft); padding: 3px; border-radius: 10px; gap: 2px; border: 1px solid var(--border-soft); }
.pill-tabs button { padding: 5px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-mute); }
.pill-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* toast */
.toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px;
  min-width: 230px; max-width: 380px; animation: slideIn 0.18s ease;
}
.toast.ok { border-left-color: var(--success); color: var(--text); }
.toast.ok::before { content: '✓ '; color: var(--success); font-weight: 800; }
.toast.err { border-left-color: var(--danger); color: var(--text); }
.toast.err::before { content: '! '; color: var(--danger); font-weight: 800; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* calendário */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); text-align: center; padding: 4px 0; font-weight: 650; }
.cal-cell {
  min-height: 74px; border: 1px solid var(--border-soft); border-radius: 9px; padding: 6px;
  background: var(--bg-soft); display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: border-color 0.12s;
}
.cal-cell:hover { border-color: var(--border); }
.cal-cell.today { border-color: var(--primary); background: var(--primary-soft); }
.cal-cell.other { opacity: 0.35; }
.cal-day { font-size: 11.5px; font-weight: 650; color: var(--text-dim); }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-ev { font-size: 10.5px; padding: 2px 5px; border-radius: 5px; background: var(--surface-3); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.alta { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.cal-ev.media { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.cal-ev.baixa { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.cal-ev.done { opacity: 0.5; text-decoration: line-through; }

/* swatches de tema */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 92px; border-radius: 11px; border: 2px solid var(--border); overflow: hidden; padding: 0;
  transition: border-color 0.13s;
}
.swatch:hover { border-color: var(--text-mute); }
.swatch.on { border-color: var(--primary); }
.swatch-preview { height: 46px; display: flex; }
.swatch-preview i { flex: 1; }
.swatch-label { font-size: 11px; padding: 6px 4px; text-align: center; color: var(--text-dim); font-weight: 600; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.color-dot.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--surface-3); }

/* em breve */
.soon {
  display: grid; place-items: center; height: calc(100vh - 62px - 44px); text-align: center;
}
.soon-box { max-width: 480px; }
.soon-icon {
  width: 74px; height: 74px; border-radius: 22px; margin: 0 auto 20px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary-soft), color-mix(in srgb, var(--accent) 14%, transparent));
  border: 1px solid var(--border); color: var(--primary); font-size: 30px;
}
.soon h2 { font-size: 22px; margin: 0 0 8px; letter-spacing: -0.02em; }
.soon p { color: var(--text-mute); font-size: 13.5px; margin: 0 0 18px; }

/* barra de filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 13px 15px; border-bottom: 1px solid var(--border-soft); }
.filters .input, .filters .select { width: auto; min-width: 150px; }

/* chart */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-size: 10px; fill: var(--text-mute); font-family: var(--font); }
.chart .grid-line { stroke: var(--border-soft); stroke-width: 1; }
.chart .bar { transition: opacity 0.13s; }
.chart .bar:hover { opacity: 0.8; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-mute); flex-wrap: wrap; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* attachment list */
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.file-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: 13px; flex: 0 0 auto; }
.file-name { font-size: 13px; font-weight: 550; }
.file-meta { font-size: 11px; color: var(--text-mute); }

/* activity timeline */
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 14px 0; }
.tl-item::before { content: ''; position: absolute; left: -18px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--surface); }
.tl-body { font-size: 12.5px; }
.tl-time { font-size: 11px; color: var(--text-mute); }

/* drag & drop hint */
.drop-hint { border: 1.5px dashed var(--border); border-radius: 11px; padding: 18px; text-align: center; color: var(--text-mute); font-size: 12.5px; }
.drop-hint.over { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }

/* ---------- campanhas de e-mail ---------- */
.mc-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border-soft); margin-bottom: var(--gap); }
.mc-tab { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text-mute); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.mc-tab:hover { color: var(--text); }
.mc-tab.active { color: var(--text); border-color: var(--primary); }
.mc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.mc-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.mc-row { display: grid; grid-template-columns: 320px repeat(var(--cols, 12), 112px); min-width: max-content; border-bottom: 1px solid var(--border-soft); }
.mc-row:last-child { border-bottom: 0; }
.mc-row > div { padding: 12px 10px; display: flex; flex-direction: column; justify-content: center; font-variant-numeric: tabular-nums; }
.mc-row > div:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); padding-left: 16px; border-right: 1px solid var(--border-soft); }
.mc-head > div { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mute); font-weight: 700; background: var(--surface-2, var(--surface)); }
.mc-head > div:first-child { background: var(--surface-2, var(--surface)); }
.mc-row .num { font-size: 15px; font-weight: 700; }
.mc-row .sub { font-size: 11px; color: var(--text-mute); }
.mc-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 11.5px; }
.mc-links a { color: var(--primary); cursor: pointer; }
.mc-links a.danger { color: var(--danger); }
.flow { display: flex; flex-direction: column; align-items: center; padding: 8px 0 24px; min-width: max-content; }
.flow-wrap { overflow: auto; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; max-height: 70vh; }
.flow-col { display: flex; flex-direction: column; align-items: center; }
.flow-line { width: 2px; height: 16px; background: var(--border); }
.flow-node { width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-sm); position: relative; }
.flow-node .tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; margin-bottom: 6px; }
.flow-node.email .tag { background: rgba(56,189,248,.16); color: #38bdf8; }
.flow-node.condition .tag { background: rgba(239,68,68,.14); color: #f87171; }
.flow-node.delay .tag { background: rgba(245,158,11,.16); color: #fbbf24; }
.flow-node.goal .tag { background: rgba(99,102,241,.18); color: var(--primary); }
.flow-node.start { width: auto; padding: 4px 18px; border-radius: 999px; background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.35); color: #4ade80; font-weight: 700; font-size: 12px; }
.flow-node .t { font-size: 13px; font-weight: 600; }
.flow-node .d { font-size: 12px; color: var(--text-dim); margin-top: 2px; white-space: pre-line; max-height: 3.9em; overflow: hidden; }
.flow-node .acts { display: flex; gap: 10px; margin-top: 8px; font-size: 11.5px; }
.flow-node .acts a { color: var(--primary); cursor: pointer; }
.flow-node .acts a.danger { color: var(--danger); }
.flow-node .st { display: flex; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--text-mute); }
.flow-add { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); cursor: pointer; display: grid; place-items: center; font-size: 16px; line-height: 1; }
.flow-add:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.flow-branches { display: flex; gap: 28px; align-items: flex-start; position: relative; margin-top: 0; }
.flow-branch { display: flex; flex-direction: column; align-items: center; min-width: 320px; }
.flow-branch > .lbl { font-size: 11px; font-weight: 700; margin: 2px 0; }
.flow-branch.sim > .lbl { color: var(--success); } .flow-branch.nao > .lbl { color: var(--danger); }
.flow-menu { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; min-width: 170px; }
.flow-menu button { text-align: left; background: none; border: 0; color: var(--text); padding: 7px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 12.5px; }
.flow-menu button:hover { background: var(--primary-soft); }
.wiz-steps { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: var(--gap); }
.wiz-step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-mute); }
.wiz-step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; }
.wiz-step.active { color: var(--text); } .wiz-step.active .dot { background: var(--primary); color: #fff; }
.wiz-step.done .dot { background: var(--success); color: #fff; }
.wiz-sep { width: 28px; height: 1px; background: var(--border); }
.mc-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); max-width: 760px; margin: 24px auto; }
.mc-choice .opt { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; text-align: center; cursor: pointer; }
.mc-choice .opt:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.mc-choice .opt .ico { width: 54px; height: 54px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 12px; }
.mc-var { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; cursor: pointer; margin: 2px 4px 2px 0; border: 0; }
.mc-preview { background: #fff; color: #222; border-radius: 10px; padding: 16px; border: 1px solid var(--border); max-height: 360px; overflow: auto; }
.mc-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.mc-seg button { background: var(--surface); border: 0; color: var(--text-dim); padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.mc-seg button.on { background: var(--primary); color: #fff; }
.alert.mc { display: block; line-height: 1.6; }
