:root {
  --bg: #0e1320;
  --bg-elev: #181f33;
  --bg-elev-2: #20283f;
  --border: #2b3650;
  --text: #e6ebf5;
  --text-muted: #8a96b3;
  --accent: #7a8bff;
  --accent-2: #a374f9;
  --ok: #3ddc97;
  --warn: #f5a524;
  --danger: #f87171;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
[v-cloak] { display: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-brand {
  display: inline-block;
  margin-bottom: 0.45rem;
  text-decoration: none;
  transition: opacity 0.15s;
}
.sidebar-brand:hover { opacity: 0.85; }
.sidebar-logo {
  height: 26px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-sub {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
  font-family: ui-monospace, monospace;
}
.nav { overflow-y: auto; padding: 0.5rem 0.5rem 1.5rem; flex: 1 1 auto; }

/* ---------- User menu (rodapé do sidebar) ---------- */
.sidebar-user {
  border-top: 1px solid var(--border);
  padding: 0.85rem 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--bg);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}
.user-info { min-width: 0; flex: 1; }
.user-name {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { display: flex; align-items: center; gap: 0.3rem; margin-top: 2px; }
.user-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}
.user-badge-admin {
  color: var(--accent-2, var(--accent));
  background: rgba(122, 139, 255, 0.10);
}
.user-badge-super {
  color: var(--warn);
  background: rgba(245, 165, 36, 0.12);
  border: 1px solid rgba(245, 165, 36, 0.35);
}
.user-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.55rem 0.85rem;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 0.15s;
}
.user-logout-btn:hover {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
}
.user-logout-btn svg { flex-shrink: 0; }

/* ---------- Admin nav item destacado ---------- */
.nav-item-admin {
  color: var(--warn) !important;
}
.nav-item-admin.active {
  background: rgba(245, 165, 36, 0.10) !important;
  color: var(--warn) !important;
}
.nav-section + .nav-section { margin-top: 1.25rem; }
.nav-title {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.6rem 0.75rem 0.4rem;
}
.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.85rem;
  user-select: none;
}
.nav-item:hover { background: var(--bg-elev-2); }
.nav-item.active { background: rgba(122, 139, 255, 0.12); color: var(--accent); }
.nav-count {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 999px;
  min-width: 28px;
  text-align: center;
}
.nav-item.active .nav-count { color: var(--accent); background: rgba(122, 139, 255, 0.15); }

/* Main */
.main {
  overflow: auto;
  padding: 1.5rem 2rem 3rem;
}
.loading, .error {
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}
.error { color: var(--danger); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.topbar-left h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.topbar-tag {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-elev);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.topbar-count { color: var(--text-muted); font-size: 0.85rem; }
.search {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  min-width: 220px;
  outline: none;
  font-family: inherit;
}
.search:focus { border-color: var(--accent); }
.description {
  color: var(--text-muted);
  margin: 0.5rem 0 1.25rem;
  max-width: 760px;
  line-height: 1.55;
}
.description code {
  background: var(--bg-elev);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Table */
.table-wrapper {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  max-height: calc(100vh - 200px);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
}
.data-table thead {
  background: var(--bg-elev-2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table th {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-weight: 600;
  color: var(--text);
}
.th-name { font-size: 0.78rem; }
.th-type {
  color: var(--text-muted);
  font-weight: 400;
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  margin-top: 2px;
}
.th-pk .th-name::before { content: '🔑 '; opacity: 0.6; }
.data-table td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.row { cursor: pointer; transition: background 0.08s; }
.row:hover { background: var(--bg-elev-2); }
.cell-pk { font-weight: 600; }
.cell-text, .cell-varchar { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

.id-pill {
  font-family: ui-monospace, monospace;
  color: var(--accent);
  background: rgba(122, 139, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
}

.bool-true { color: var(--ok); font-weight: 600; }
.bool-false { color: var(--text-muted); }

.empty {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Badges (enums) */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
}
.badge-ok {
  color: var(--ok);
  border-color: rgba(61, 220, 151, 0.3);
  background: rgba(61, 220, 151, 0.08);
}
.badge-warn {
  color: var(--warn);
  border-color: rgba(245, 165, 36, 0.3);
  background: rgba(245, 165, 36, 0.08);
}
.badge-danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}
/* Account canônica resolvida pelo identity spine. ↔ N indica N orgs Pipedrive agrupadas. */
.badge-canonical {
  color: var(--accent-2, var(--accent));
  border-color: rgba(122, 139, 255, 0.45);
  background: rgba(122, 139, 255, 0.12);
  margin-left: 0.4rem;
  font-weight: 600;
}
.canonical-raw { font-size: 0.72rem; margin-left: 0.4rem; font-style: italic; }

/* ---------- Admin: modal + tabela de usuários ---------- */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: fade-in 0.15s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.admin-modal {
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem 1.85rem 1.5rem;
  min-width: 460px;
  max-width: 560px;
  box-shadow: 0 24px 56px -12px rgba(0,0,0,0.5);
  animation: modal-pop 0.2s cubic-bezier(.2,.9,.4,1.2);
}
@keyframes modal-pop {
  from { transform: translateY(8px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.admin-modal h2 {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  color: var(--text);
}
.admin-modal form { display: flex; flex-direction: column; gap: 0.85rem; }
.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.6rem;
}
.admin-actions {
  display: inline-flex;
  gap: 0.3rem;
}
.btn-mini {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1;
}
.btn-mini:hover {
  background: var(--bg-elev-2);
  border-color: var(--accent);
}
.btn-mini-danger:hover {
  background: rgba(248, 113, 113, 0.10);
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--danger);
}
.row-inactive { opacity: 0.55; }

/* Botão primário (usado no admin + outros) */
.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 0.55rem 1.05rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 3px 10px -2px rgba(122, 139, 255, 0.4);
}
.btn-primary:hover { box-shadow: 0 4px 14px -2px rgba(122, 139, 255, 0.5); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

/* Login fields reutilizados no admin modal — copia de login.css simplificada */
.login-field { display: flex; flex-direction: column; gap: 0.35rem; }
.login-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  font-family: ui-monospace, monospace;
}
.login-label small { font-weight: 400; opacity: 0.65; text-transform: none; letter-spacing: 0; margin-left: 0.3rem; }
.login-field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 139, 255, 0.18);
}

/* AI loading state (Definicoes_Interface §1.5) — seções LLM-derived mostram skeleton + "Executando IA…"
   enquanto contacts/crm_tech/tech_stack carregam (~3-8s). Frontend renderiza tudo o resto antes. */
.ai-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(122, 139, 255, 0.18), rgba(165, 180, 252, 0.10));
  border: 1px solid rgba(122, 139, 255, 0.4);
  color: var(--accent-2, var(--accent));
  margin-left: 0.5rem;
  letter-spacing: 0.01em;
  animation: ai-loading-glow 2s ease-in-out infinite;
}
@keyframes ai-loading-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(122, 139, 255, 0.0); }
  50%      { box-shadow: 0 0 0 4px rgba(122, 139, 255, 0.15); }
}
.ai-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(122, 139, 255, 0.25);
  border-top-color: var(--accent-2, var(--accent));
  animation: ai-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.badge-ai-loading {
  color: var(--accent-2, var(--accent));
  border-color: rgba(122, 139, 255, 0.45);
  background: rgba(122, 139, 255, 0.10);
  font-style: italic;
  animation: ai-loading-glow 2s ease-in-out infinite;
}
.ai-loading-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.4rem 0;
}
.ai-shimmer-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(122, 139, 255, 0.12) 50%, var(--bg) 100%);
  background-size: 200% 100%;
  animation: ai-shimmer 1.4s ease-in-out infinite;
  width: 100%;
}
.ai-shimmer-line-md { width: 75%; }
.ai-shimmer-line-sm { width: 50%; height: 9px; }
@keyframes ai-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Drawer (detail panel) */
.drawer {
  position: fixed;
  right: 0; top: 0;
  height: 100vh;
  width: 460px;
  max-width: 100vw;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0,0,0,0.4);
  z-index: 10;
  animation: slideIn 0.18s ease-out;
}
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: 1rem; font-weight: 600; }
.drawer-tag {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: inline-block;
}
.detail-list {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-y: auto;
}
.detail-list dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.85rem;
  font-family: ui-monospace, monospace;
}
.detail-list dt:first-child { margin-top: 0; }
.detail-type {
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
  opacity: 0.7;
  margin-left: 6px;
}
.detail-list dd {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  word-break: break-all;
}
.detail-list dd code {
  font-family: ui-monospace, monospace;
  color: var(--accent);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  display: inline-block;
}
.detail-list dd pre {
  background: var(--bg);
  padding: 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  overflow: auto;
  margin: 0.25rem 0 0;
}

/* Buttons & inputs */
.btn {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--bg);
}
.btn-ghost { background: transparent; }

/* Resolver / Connectors */
.resolver-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.connectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.card h2 { margin: 0 0 0.85rem; font-size: 0.95rem; font-weight: 600; }
.card h3 { margin: 0 0 0.4rem; font-size: 0.95rem; color: var(--accent); }
.card label {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
  margin-top: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card label:first-child { margin-top: 0; }
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
}
.input:focus { border-color: var(--accent); }
select.input { cursor: pointer; }
.identifier-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.row-buttons { display: flex; gap: 0.5rem; margin: 0.75rem 0 1rem; flex-wrap: wrap; }
.json {
  background: var(--bg);
  padding: 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  overflow: auto;
  max-height: 360px;
  margin: 0;
  font-family: ui-monospace, monospace;
}
.muted { color: var(--text-muted); font-size: 0.85rem; }
.connector-stat {
  margin-top: 0.85rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}
.connector-stat span {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Pipedrive section */
.pipedrive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.pd-block { margin-bottom: 1rem; }
.meta-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; }
.meta-list dt { color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 0.78rem; }
.meta-list dd { margin: 0; font-size: 0.85rem; word-break: break-all; }
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.pipeline-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}
.pipeline-chip strong { font-weight: 600; }
.pipeline-chip .muted { font-size: 0.72rem; margin-top: 2px; font-family: ui-monospace, monospace; }

.pd-resolver-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.pd-resolver-header h3 { margin: 0; }

.resolver-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.stat-value { font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.stat-unit { font-size: 0.85rem; color: var(--text-muted); margin-left: 4px; font-weight: 400; }
.stat-label { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

.account-list { display: flex; flex-direction: column; gap: 0.6rem; }
.account-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
}
.account-card-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.account-card-head strong { font-size: 0.95rem; }
.account-card-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.account-card-meta strong { color: var(--text); font-weight: 500; }
.history { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }
.history-event {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-elev-2);
  font-family: ui-monospace, monospace;
}
.history-ganho { color: var(--ok); border: 1px solid rgba(61, 220, 151, 0.3); }
.history-churn { color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.3); }
.history-renovacao, .history-upgrade { color: var(--accent); border: 1px solid rgba(122, 139, 255, 0.3); }
.persons-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; align-items: center; font-size: 0.8rem; }
.person-chip {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
}
.person-chip.res-reused { color: var(--ok); border-color: rgba(61, 220, 151, 0.3); }
.person-chip.res-would_create { color: var(--warn); border-color: rgba(245, 165, 36, 0.3); }
.person-chip.res-no_identifiers { color: var(--text-muted); }

.apply-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 0.4rem 0.5rem;
}
.apply-toggle input { cursor: pointer; }

.mapper-tables { margin-top: 1.25rem; }
.mapper-tables h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.85rem;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  font-weight: 500;
}
.mapper-tables h4:first-child { margin-top: 0.5rem; }
.mapper-tables .data-table { font-size: 0.78rem; }

/* Entidades — sub-sidebar + main */
.entities-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  height: calc(100vh - 3rem);
  align-items: start;
}
.entities-nav {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.5rem;
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
.entities-nav-title {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.75rem 0.6rem;
}
.entities-nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  user-select: none;
}
.entities-nav-item:hover { background: var(--bg-elev-2); }
.entities-nav-item.active { background: rgba(122, 139, 255, 0.12); color: var(--accent); }
.entities-nav-item.active .nav-count { color: var(--accent); background: rgba(122, 139, 255, 0.15); }
.entities-main { min-width: 0; }

/* Accounts — search */
.accounts-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.5rem 0 1.25rem;
}
.accounts-search {
  flex: 1;
  max-width: 560px;
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
}
.cell-custom-fields { max-width: 360px; }

.llm-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.llm-reasoning {
  flex-basis: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.llm-reasoning summary { cursor: pointer; color: var(--accent); user-select: none; }
.llm-reasoning p { margin: 0.4rem 0 0; line-height: 1.45; max-width: 800px; }

/* Account detail — largura fixa, centralizada em .main */
.account-page { max-width: 1340px; }

/* ---------- Tela de boas-vindas (home / Pesquisas) ----------
   Centralização vertical quando ainda não há resultados de busca: o conteúdo
   (banner + caixa + tip) fica empurrado pra perto do meio do viewport, dando
   sensação de "tela inicial" elegante. Quando aparece tabela de resultados,
   o conteúdo cresce naturalmente pra baixo. */
.welcome-shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0.5rem 0 2rem;
  /* Centralização vertical: ocupa altura disponível e empurra conteúdo pro meio.
     Quando há tabela de resultados, justify-content desliga via classe condicional. */
  min-height: calc(100vh - 4rem);
  justify-content: center;
}
/* Quando há resultados, conteúdo cresce pro topo — não centraliza mais */
.welcome-shell.has-results {
  justify-content: flex-start;
  min-height: 0;
  padding-top: 1.5rem;
}
.welcome-banner {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 2rem 2.2rem;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(165, 180, 252, 0.18), transparent 50%),
    linear-gradient(135deg, rgba(122, 139, 255, 0.10) 0%, rgba(26, 34, 56, 0.4) 100%);
  border: 1px solid rgba(122, 139, 255, 0.28);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 8px 32px -12px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(122,139,255,0.18), transparent 60%);
  pointer-events: none;
}
.welcome-mascot {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(122,139,255,0.22), rgba(165,180,252,0.10));
  border: 2px solid rgba(122, 139, 255, 0.35);
  padding: 8px;
  flex-shrink: 0;
  box-shadow: 0 4px 20px -4px rgba(122, 139, 255, 0.4);
  animation: welcome-mascot-float 4s ease-in-out infinite;
}
@keyframes welcome-mascot-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}
.welcome-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.welcome-greeting {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.welcome-greeting strong {
  color: var(--text);
  font-weight: 700;
}
.welcome-title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.welcome-brand {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.welcome-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 640px;
}

/* Quick links — atalhos pras seções */
.welcome-quicklinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}
.welcome-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.1rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  color: inherit;
}
.welcome-card:hover {
  background: var(--bg-elev-2);
  border-color: rgba(122, 139, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(122, 139, 255, 0.3);
}
.welcome-card-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(122,139,255,0.16), rgba(165,180,252,0.06));
  border: 1px solid rgba(122, 139, 255, 0.25);
}
.welcome-card-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin-bottom: 0.2rem;
}
.welcome-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.welcome-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  background: rgba(245, 165, 36, 0.06);
  border: 1px solid rgba(245, 165, 36, 0.30);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}
.welcome-tip-icon { font-size: 1.05rem; flex-shrink: 0; line-height: 1.55; }
.welcome-tip strong { color: var(--warn); font-weight: 600; }

/* Caixa de busca da home (Pesquisas) — versão maior + destaque pra ser o foco.
   Largura: alinha 100% com banner (em cima) e tabela (em baixo). */
.welcome-search-wrap {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}
.welcome-search {
  flex: 1 1 100%;
  font-size: 1.05rem !important;
  padding: 0.95rem 1.2rem !important;
  border-radius: 10px !important;
  background: var(--bg-elev) !important;
  border: 1.5px solid rgba(122, 139, 255, 0.35) !important;
  box-shadow: 0 4px 20px -8px rgba(122, 139, 255, 0.25);
  width: 100%;
  box-sizing: border-box;
}
.welcome-search:focus {
  border-color: var(--accent-2, var(--accent)) !important;
  box-shadow: 0 0 0 4px rgba(122, 139, 255, 0.18), 0 4px 20px -8px rgba(122, 139, 255, 0.4) !important;
}

/* Pesquisas item destacado no sidebar (primeiro) */
.nav-item-pesquisas {
  font-weight: 700;
  letter-spacing: -0.005em;
}
.nav-item-pesquisas.active {
  background: linear-gradient(90deg, rgba(122, 139, 255, 0.22), rgba(165, 180, 252, 0.08)) !important;
  border-left: 3px solid var(--accent-2, var(--accent));
}

/* ---------- Loading durante busca (com indicador de refinamento por IA) ---------- */
.search-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.search-loading.is-ai {
  background: linear-gradient(90deg, rgba(122, 139, 255, 0.14), rgba(165, 180, 252, 0.06));
  border-color: rgba(122, 139, 255, 0.40);
  color: var(--text);
  animation: search-loading-glow 2s ease-in-out infinite;
}
.search-loading.is-ai strong {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}
@keyframes search-loading-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(122, 139, 255, 0.0); }
  50%      { box-shadow: 0 0 0 4px rgba(122, 139, 255, 0.12); }
}
.search-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(122, 139, 255, 0.25);
  border-top-color: var(--accent-2, var(--accent));
  animation: spin-360 0.8s linear infinite;
  flex-shrink: 0;
}
.search-loading:not(.is-ai) .search-spinner {
  border-color: rgba(139, 148, 176, 0.25);
  border-top-color: var(--text-muted);
}
@keyframes spin-360 { to { transform: rotate(360deg); } }



/* Tabs do dossiê (Definicoes_Interface §1.6): Visão Geral | Deals Relacionados.
   Pílulas grandes, claramente "botões" — diferenciadas do resto da interface. */
.account-tabs {
  display: flex;
  gap: 0.65rem;
  margin: 1.25rem 0 1.75rem;
  padding: 0.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: fit-content;
}
.account-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1.6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  letter-spacing: -0.005em;
  font-family: inherit;
  min-height: 48px;
}
.account-tab:hover:not(.active) {
  color: var(--text);
  background: var(--bg-elev-2);
  transform: translateY(-1px);
}
.account-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
  box-shadow:
    0 4px 14px -2px rgba(122, 139, 255, 0.45),
    0 0 0 1px rgba(255,255,255,0.06) inset;
  transform: translateY(-1px);
}
.account-tab .tab-icon { font-size: 1.18rem; line-height: 1; }
.account-tab .tab-count {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(122, 139, 255, 0.14);
  color: var(--accent-2, var(--accent));
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 0.15rem;
  min-width: 28px;
  text-align: center;
}
.account-tab.active .tab-count {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.account-tab-content { animation: tab-fade-in 0.2s ease-out; }
@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Identity Resolver: barra explicando quais orgs Pipedrive foram agrupados nesta Account.
   Aparece só quando há merge (group_size > 1). Crítico pra usuário entender por que tem
   mais deals do que ele esperava (ex: Gimba mostra 12 deals porque agrega 5 orgs). */
.canonical-info-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(122, 139, 255, 0.10), rgba(165, 180, 252, 0.04));
  border: 1px solid rgba(122, 139, 255, 0.35);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin: 0.6rem 0 0.85rem;
  font-size: 0.84rem;
  color: var(--text);
}
.canonical-info-icon { font-size: 1.05rem; line-height: 1; }
.canonical-info-label strong { color: var(--accent-2, var(--accent)); font-weight: 700; }
.canonical-info-orgs { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.canonical-org-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

/* Deals Relacionados table — refinada do .data-table base, com link e badges */
.deals-table-wrapper { margin-top: 0.6rem; }
.deals-related-table th { white-space: nowrap; }
.deal-row { transition: background 0.12s ease; }
.deal-row:hover { background: var(--bg-elev); }
.deal-title-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 240px;
}
.deal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: -0.005em;
}
.deal-link strong { color: var(--text); }
.deal-link:hover strong { color: var(--accent-2, var(--accent)); text-decoration: underline; }
.deal-link .deal-link-icon { display: inline-flex; opacity: 0.55; transition: opacity 0.12s; }
.deal-link .deal-link-icon svg { width: 12px; height: 12px; }
.deal-link:hover .deal-link-icon { opacity: 1; color: var(--accent-2, var(--accent)); }
.deal-id-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}
.deal-status-mini { font-size: 0.65rem !important; padding: 0 6px !important; align-self: flex-start; }
.stage-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(122, 139, 255, 0.10);
  border: 1px solid rgba(122, 139, 255, 0.30);
  color: var(--accent-2, var(--accent));
  font-size: 0.78rem;
  font-weight: 500;
}
.cnpj-cell { font-family: ui-monospace, monospace; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.muted-cell { color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 0.82rem; white-space: nowrap; }
.value-cell { font-family: ui-monospace, monospace; font-weight: 500; white-space: nowrap; text-align: right; }
.mrr-cell { font-family: ui-monospace, monospace; white-space: nowrap; text-align: right; }
.mrr-cell strong {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}
.phone-cell { font-family: ui-monospace, monospace; font-size: 0.85rem; white-space: nowrap; }
.phone-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  text-decoration: none;
}
.phone-link:hover { color: var(--ok); }
.phone-link .contact-icon { display: inline-flex; }
.phone-link .contact-icon svg { width: 13px; height: 13px; }
.account-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
}
.account-hero-name h1 {
  margin: 0 0 0.7rem;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
}
.account-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
}
.account-segment.seg-0 { color: var(--text-muted); }
.account-segment.seg-1 { color: #94a3b8; border-color: #334155; }
.account-segment.seg-2 { color: var(--accent); border-color: rgba(122, 139, 255, 0.4); background: rgba(122, 139, 255, 0.06); }
.account-segment.seg-3 {
  color: var(--warn);
  border-color: rgba(245, 165, 36, 0.5);
  background: rgba(245, 165, 36, 0.1);
  box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.05);
}
.account-segment.seg-4 {
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: var(--accent-2);
  box-shadow: 0 4px 16px rgba(122, 139, 255, 0.4);
  font-weight: 700;
}
.seg-icon { font-size: 1.05rem; }
.seg-source { font-size: 0.7rem; opacity: 0.6; font-weight: 400; margin-left: 6px; font-family: ui-monospace, monospace; }

/* Funil geral comercial (Definicoes §2): prospect → lead → oportunidade → cliente → churned */
.account-funnel {
  margin-top: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: help;
}
.funnel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.funnel-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.25rem 0;
}
.funnel-track::before {
  content: '';
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: 50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.funnel-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 88px;
  gap: 0.3rem;
}
.funnel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: all 0.15s ease;
}
.funnel-step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}
/* States */
.funnel-step.past .funnel-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.funnel-step.past .funnel-step-label { color: var(--text); opacity: 0.75; }

.funnel-step.current .funnel-dot {
  background: var(--accent-2, var(--accent));
  border-color: var(--accent-2, var(--accent));
  width: 16px;
  height: 16px;
  box-shadow: 0 0 0 4px rgba(122, 139, 255, 0.18);
}
.funnel-step.current .funnel-step-label {
  color: var(--text);
  font-weight: 700;
}

.funnel-step.future .funnel-dot { background: var(--bg); border-color: var(--border); }
.funnel-step.future .funnel-step-label { color: var(--text-muted); opacity: 0.55; }

.funnel-step.idle .funnel-dot { background: var(--bg); border-color: var(--border); opacity: 0.4; }
.funnel-step.idle .funnel-step-label { color: var(--text-muted); opacity: 0.4; }

/* Churned: estado terminal vermelho — etapas anteriores em tom apagado, churn em destaque */
.funnel-step.past-churned .funnel-dot {
  background: rgba(239, 68, 68, 0.45);
  border-color: rgba(239, 68, 68, 0.55);
}
.funnel-step.past-churned .funnel-step-label {
  color: var(--text-muted);
  opacity: 0.7;
}
.funnel-step.step-churned.current .funnel-dot {
  background: var(--danger, #ef4444);
  border-color: var(--danger, #ef4444);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
}
.funnel-step.step-churned.current .funnel-step-label {
  color: var(--danger, #ef4444);
  font-weight: 700;
}

/* Quando funil termina em "cliente", a etapa "churned" fica visualmente sumida */
.funnel-track.is-cliente .funnel-step.step-churned { opacity: 0.35; }
.funnel-track.is-cliente .funnel-step.step-churned .funnel-dot { border-style: dashed; }


.account-mrr-card { text-align: right; min-width: 220px; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.account-mrr-card .info-label { text-align: right; }

/* "Cliente desde: mês/ano" — destaque no hero pra accounts que viraram cliente.
   Definicoes_Interface §1.2 + spec §2.2. Posicionado abaixo do MRR. */
.customer-since-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.18), rgba(61, 220, 151, 0.06));
  border: 1px solid rgba(61, 220, 151, 0.55);
  color: var(--ok);
  font-size: 0.82rem;
  box-shadow: 0 2px 10px rgba(61, 220, 151, 0.15);
}
.customer-since-badge .cs-badge-icon { font-size: 0.95rem; }
.customer-since-badge .cs-badge-label {
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  opacity: 0.85;
}
.customer-since-badge .cs-badge-value {
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.mrr-value {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.account-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.info-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.95rem 1.15rem;
}
.info-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  font-family: ui-monospace, monospace;
}
.info-value {
  font-size: 0.95rem;
  word-break: break-word;
  line-height: 1.4;
}
.info-value a { color: var(--accent); text-decoration: none; }
.info-value a:hover { text-decoration: underline; }
.social-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.social-row a {
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}

.account-raw-fields { margin-top: 1rem; }
.account-raw-fields summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.5rem 0;
  user-select: none;
}
.account-raw-fields[open] summary { color: var(--accent); }
.account-raw-fields .data-table { font-size: 0.8rem; margin-top: 0.5rem; }

/* Social icons polish */
.social-card .social-row { gap: 0.5rem; flex-wrap: wrap; }
.social-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  padding: 6px 12px 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}
.social-icon-link:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.social-icon { display: inline-flex; align-items: center; justify-content: center; }
.social-icon svg { display: block; }
.social-label { font-weight: 500; }
.emoji-icon { font-size: 1.4rem; line-height: 1; }

/* Intensidade de Uso section */
.usage-section { margin-top: 1.75rem; }
.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

/* Mid row: Health Score (esquerda) + Tecnologias utilizadas (direita) */
.dossier-mid-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
@media (max-width: 1280px) {
  .dossier-mid-row { grid-template-columns: 1fr; }
}

/* Tecnologias utilizadas: standalone full-width (Definicoes_Interface §1.3 + §1.4).
   Sempre visível. As subseções (CRM | Outras) são lado-a-lado dentro do panel. */
.tecnologias-panel-standalone {
  margin-bottom: 1.5rem;
}
.tech-subsections-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 0.85rem;
}
@media (max-width: 880px) {
  .tech-subsections-row { grid-template-columns: 1fr; }
}

/* Engagement row (Definicoes_Interface §1.3 + §1.4):
   Intensidade de Uso (esquerda, flex) + Contatos (direita, fixa 360px).
   Flexbox tolera ausência de qualquer um dos lados sem quebrar layout. */
/* Wrapper antigo do engagement-row — agora apenas um container do usage-section
   completo (Health Score + grid 3 colunas Indicadores+Contatos). Sem layout flex
   próprio; o usage-grid abaixo cuida das colunas. */
.account-engagement-row { margin-bottom: 1.5rem; }
.account-engagement-row > .usage-section { margin: 0; }

/* Health score row — 3 cards no topo do bloco Intensidade de Uso.
   margin-bottom dá respiro entre HS e Indicadores+Contatos (linha de baixo). */
.health-score-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.85fr;
  gap: 0.85rem;
  margin-bottom: 1.4rem;  /* respiro entre HS e linhas abaixo */
}

/* Tecnologias utilizadas panel */
.tecnologias-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.tech-panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.tech-subsection {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
}
.tech-subhead {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.tech-subhead h4 {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: ui-monospace, monospace;
  font-weight: 500;
}
.tech-item-name {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tech-item-name.tech-no { color: var(--warn); background: none; -webkit-text-fill-color: var(--warn); }
.tech-item-name.tech-unknown { color: var(--text-muted); background: none; -webkit-text-fill-color: var(--text-muted); font-weight: 500; }
.tech-item-meta { font-size: 0.75rem; margin-top: 2px; }
.tech-evidence { font-size: 0.78rem; line-height: 1.4; margin-top: 0.4rem; padding-left: 0.5rem; border-left: 2px solid var(--accent); }
.tech-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tech-list-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.tech-icon { font-size: 1rem; line-height: 1; }
.health-score-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  position: relative;
  overflow: hidden;
}
.health-score-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.health-score-card.hs-secondary { background: var(--bg); }
/* Definicoes_Interface §2.1 — paleta por faixa
   green (>=50) | yellow (25-50) | orange forte (0.1-25) | red-zero (==0) com ⚠ | neutral (null) */
.health-score-card.hs-green::before    { background: linear-gradient(90deg, #16a34a, #22c55e); }
.health-score-card.hs-yellow::before   { background: linear-gradient(90deg, #eab308, #facc15); }
.health-score-card.hs-orange::before   { background: linear-gradient(90deg, #ea580c, #f97316); }
.health-score-card.hs-red-zero::before { background: linear-gradient(90deg, #b91c1c, #dc2626); height: 5px; box-shadow: 0 0 12px rgba(220, 38, 38, 0.55); }
.health-score-card.hs-neutral::before  { background: linear-gradient(90deg, #475569, #64748b); }
/* Card de zero absoluto: borda vermelha forte pra reforçar o alerta */
.health-score-card.hs-red-zero {
  border-color: rgba(220, 38, 38, 0.55);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), var(--bg-elev));
}
.hs-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  font-family: ui-monospace, monospace;
}
.hs-value {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0.4rem 0 0.3rem;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hs-green .hs-value    { background: linear-gradient(90deg, #16a34a, #22c55e); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hs-yellow .hs-value   { background: linear-gradient(90deg, #eab308, #facc15); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hs-orange .hs-value   { background: linear-gradient(90deg, #ea580c, #f97316); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hs-red-zero .hs-value { background: linear-gradient(90deg, #b91c1c, #dc2626); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 800; }
.hs-neutral .hs-value  { background: linear-gradient(90deg, #94a3b8, #cbd5e1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
/* Idem para o card secundário (hs-value-sm) */
.hs-green .hs-value-sm    { color: #16a34a; }
.hs-yellow .hs-value-sm   { color: #eab308; }
.hs-orange .hs-value-sm   { color: #ea580c; }
.hs-red-zero .hs-value-sm { color: #dc2626; font-weight: 800; }
.hs-neutral .hs-value-sm  { color: var(--text-muted); }
/* Ícone de alerta pro zero absoluto (Definicoes_Interface §2.1) */
.hs-alert {
  display: inline-block;
  margin-right: 0.4rem;
  color: #dc2626;
  font-size: 0.95rem;
  animation: hs-alert-pulse 1.6s ease-in-out infinite;
}
@keyframes hs-alert-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(1.1); }
}
.hs-value-sm {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0.4rem 0 0.3rem;
}
.hs-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

/* Usage grid: 3 colunas (Indicadores de Uso | Indicadores de Contratação | Contatos).
   Contatos voltou aqui (de sidebar fixa pra coluna alinhada horizontalmente com
   os outros dois indicadores — top e bottom batem visualmente). */
.usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: stretch;
}
@media (max-width: 1180px) {
  .usage-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .usage-grid > .contacts-panel { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  .usage-grid { grid-template-columns: 1fr; }
  .usage-grid > .contacts-panel { grid-column: 1; }
}
.usage-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}
.usage-panel h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 0.85rem;
  letter-spacing: -0.005em;
}
.usage-panel h3 .muted { font-size: 0.75rem; font-weight: 400; margin-left: 6px; }

/* Bar chart (vertical panel, horizontal bars) */
.usage-bars { display: flex; flex-direction: column; gap: 0.85rem; }
.usage-metric {
  background: var(--bg);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}
.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}
.metric-label { font-size: 0.82rem; font-weight: 500; }
.metric-trend { display: inline-flex; }
.metric-bars { display: flex; flex-direction: column; gap: 4px; }
.metric-bar-row {
  display: grid;
  grid-template-columns: 32px 1fr 60px;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
}
.metric-period {
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  text-transform: lowercase;
}
.metric-bar-wrap {
  background: rgba(255,255,255,0.04);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.metric-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  transition: width 0.4s ease-out;
  min-width: 2px;
}
.metric-bar.bar-30 {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.metric-bar.bar-90 {
  background: linear-gradient(90deg, #475569, #64748b);
  opacity: 0.85;
}
.metric-value {
  text-align: right;
  font-family: ui-monospace, monospace;
  font-weight: 600;
  color: var(--text);
}

/* Contract list */
.contract-list { display: flex; flex-direction: column; gap: 0.4rem; }
.contract-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0.6rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.85rem;
  gap: 0.85rem;
}
.contract-label { color: var(--text-muted); flex-shrink: 0; }
.contract-value { font-weight: 600; text-align: right; word-break: break-word; }
.contract-value.contract-currency { color: var(--accent); }
.contract-value.contract-number { font-family: ui-monospace, monospace; }

/* Trend icon next to section title */
.section-title { display: inline-flex; align-items: center; gap: 8px; }
.section-trend { display: inline-flex; align-items: center; }
.section-trend svg { width: 18px; height: 18px; }

/* (deprecated: right-stack removido; Contatos agora vai pra dossier-top) */

/* Contacts panel */
.contacts-panel h3 { display: flex; align-items: center; gap: 8px; }
.contacts-stack { display: flex; flex-direction: column; gap: 0.7rem; }
.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  position: relative;
}
.contact-role {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed var(--border);
}
.contact-role-icon { font-size: 1rem; line-height: 1; }
.contact-role-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  font-family: ui-monospace, monospace;
}
.contact-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
}
.contact-cargo {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.4rem 0 0;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text);
  text-decoration: none;
  padding: 3px 0;
}
.contact-link:hover { color: var(--accent); }
.contact-link:hover .contact-link-text { text-decoration: underline; }
.contact-icon { display: inline-flex; flex-shrink: 0; }
.contact-icon svg { display: block; }
.contact-link-text { word-break: break-all; }
.contact-reasoning {
  font-size: 0.72rem;
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.35;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
}
.contact-empty { font-size: 0.85rem; padding: 0.4rem 0; }

/* Histórico de Contrato — vertical timeline */
.contract-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.contract-history-head .section-title { margin: 0; }
.contract-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.contract-status-badge .cs-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.contract-status-badge.cs-active   { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.08); }
.contract-status-badge.cs-active   .cs-dot { background: var(--ok); box-shadow: 0 0 8px rgba(61, 220, 151, 0.6); }
.contract-status-badge.cs-churned  { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }
.contract-status-badge.cs-churned  .cs-dot { background: var(--danger); }
.contract-status-badge.cs-unknown  { color: var(--text-muted); }
.contract-status-badge.cs-unknown  .cs-dot { background: var(--text-muted); }
.contract-status-badge .muted { font-size: 0.78rem; font-weight: 400; }

/* Pills de data destacadas no badge de status (Definicoes_Interface §1.2 + spec §2.2) */
.cs-date-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  margin-left: 0.4rem;
  line-height: 1.1;
  font-family: ui-monospace, monospace;
}
.cs-date-pill .cs-date-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.75;
  font-weight: 500;
}
.cs-date-pill .cs-date-value { font-size: 0.92rem; font-weight: 700; letter-spacing: 0; }
.cs-date-pill.cs-due-date,
.cs-date-pill.cs-due-future {
  background: rgba(61, 220, 151, 0.18);
  border: 1px solid rgba(61, 220, 151, 0.55);
  color: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.06);
}
.cs-date-pill.cs-due-overdue {
  background: rgba(220, 38, 38, 0.20);
  border: 1px solid rgba(220, 38, 38, 0.65);
  color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
  animation: due-overdue-pulse 2.4s ease-in-out infinite;
}
.cs-date-pill.cs-due-overdue .cs-date-label { color: #fecaca; font-weight: 700; }
.cs-date-pill.cs-due-overdue .cs-date-value { color: #fff; }
@keyframes due-overdue-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10); }
  50%      { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.22); }
}
.cs-date-pill.cs-due-unknown {
  background: rgba(245, 165, 36, 0.16);
  border: 1px solid rgba(245, 165, 36, 0.55);
  color: var(--warn);
  box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.05);
}
.cs-date-pill.cs-due-unknown .cs-date-value { font-style: italic; font-weight: 600; }
.cs-date-pill.cs-churn-date {
  background: rgba(248, 113, 113, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.55);
  color: var(--danger);
}

.timeline {
  position: relative;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--border) 30%, var(--border) 70%, transparent 100%);
  opacity: 0.5;
}
.timeline-event {
  display: grid;
  /* Cols: marker (38px) | data pill (auto) | card (1fr) — Definicoes_Interface §1.2 */
  grid-template-columns: 38px auto 1fr;
  gap: 0.75rem;
  align-items: center;
  position: relative;
}
.timeline-marker {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.timeline-event.tl-entrada_funil .timeline-marker { border-color: var(--accent); }
.timeline-event.tl-oportunidade  .timeline-marker { border-color: var(--accent-2); }
.timeline-event.tl-ganho         .timeline-marker { border-color: var(--ok); background: rgba(61, 220, 151, 0.08); }
.timeline-event.tl-renovacao     .timeline-marker { border-color: var(--accent); background: rgba(122, 139, 255, 0.08); }
.timeline-event.tl-upgrade       .timeline-marker { border-color: var(--warn); background: rgba(245, 165, 36, 0.08); }
.timeline-event.tl-churn         .timeline-marker { border-color: var(--danger); background: rgba(248, 113, 113, 0.1); }
.timeline-icon { font-size: 1.05rem; line-height: 1; }

/* Data destacada logo após o ícone (Definicoes_Interface §1.2). Cor varia por tipo de evento. */
.timeline-date-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  min-width: 96px;
  justify-content: center;
}
.timeline-event.tl-entrada_funil .timeline-date-pill { color: var(--accent);   border-color: rgba(122, 139, 255, 0.45); background: rgba(122, 139, 255, 0.08); }
.timeline-event.tl-oportunidade  .timeline-date-pill { color: var(--accent-2); border-color: rgba(122, 139, 255, 0.55); background: rgba(122, 139, 255, 0.10); }
.timeline-event.tl-ganho         .timeline-date-pill { color: var(--ok);       border-color: rgba(61, 220, 151, 0.55);  background: rgba(61, 220, 151, 0.12); }
.timeline-event.tl-renovacao     .timeline-date-pill { color: var(--accent);   border-color: rgba(122, 139, 255, 0.45); background: rgba(122, 139, 255, 0.10); }
.timeline-event.tl-upgrade       .timeline-date-pill { color: var(--warn);     border-color: rgba(245, 165, 36, 0.55);  background: rgba(245, 165, 36, 0.12); }
.timeline-event.tl-churn         .timeline-date-pill { color: var(--danger);   border-color: rgba(248, 113, 113, 0.55); background: rgba(248, 113, 113, 0.12); }
.timeline-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
  flex: 1;
  min-width: 0;
}
.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}
.timeline-label { font-size: 0.95rem; font-weight: 600; }
/* .timeline-date removed — data agora vive no .timeline-date-pill ao lado do ícone */
.timeline-deal { font-size: 0.78rem; margin-bottom: 0.4rem; word-break: break-word; }
.timeline-value-change {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.value-old { color: var(--text-muted); text-decoration: line-through; font-family: ui-monospace, monospace; }
.value-arrow { color: var(--accent); font-weight: 700; }
.value-new { color: var(--accent); font-weight: 600; font-family: ui-monospace, monospace; }
.value-delta { font-size: 0.75rem; padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, monospace; }
.value-delta.value-up   { color: var(--ok); background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.3); }
.value-delta.value-down { color: var(--danger); background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.3); }
.timeline-value { color: var(--accent); font-weight: 600; font-family: ui-monospace, monospace; font-size: 0.88rem; }

/* MRR + período por evento (entidades_canonicas_v1.md §account_contract_event +
   Definicoes_Interface §1.2.2 — cada item da timeline mostra MRR e período de vigência) */
.timeline-mrr-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.timeline-mrr {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
.mrr-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}
.mrr-suffix { font-size: 0.72rem; font-family: ui-monospace, monospace; }
.timeline-mrr .value-new { font-size: 1rem; font-weight: 700; }
.timeline-period {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  font-family: ui-monospace, monospace;
  flex-wrap: wrap;
}
.period-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  font-size: 0.62rem;
  opacity: 0.8;
}
.period-value { color: var(--text); }
.period-months { font-size: 0.7rem; opacity: 0.65; }
/* Downsell visual: borda à esquerda do card alaranjada-vermelha */
.timeline-event.tl-downsell .timeline-marker { border-color: var(--warn); background: rgba(245, 165, 36, 0.15); }
.timeline-event.tl-downsell .timeline-date-pill { color: var(--warn); border-color: rgba(245, 165, 36, 0.55); background: rgba(245, 165, 36, 0.12); }

/* CRM Utilizado */
.crm-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
}
.crm-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}
.crm-meta {
  font-size: 0.78rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.crm-evidence {
  font-size: 0.82rem;
  padding: 0.5rem 0.8rem;
  background: var(--bg);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  margin-top: 0.4rem;
  line-height: 1.4;
}
.crm-evidence em { color: var(--text); font-style: italic; }
.crm-other { margin-top: 0.6rem; font-size: 0.78rem; }
.crm-other summary { cursor: pointer; color: var(--accent); user-select: none; }
.crm-other ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.crm-other li { margin: 0.25rem 0; }

.crm-card-no { border-left: 3px solid var(--warn); }
.crm-name-no {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--warn);
  margin-bottom: 0.4rem;
}
.crm-card-unknown { border-left: 3px solid var(--text-muted); opacity: 0.85; }
.crm-name-unknown {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.crm-card-unknown p { margin: 0.4rem 0 0; line-height: 1.45; }

.last-interaction-card .info-value {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.activity-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}
.activity-line {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.92rem;
}
.activity-line .muted { font-size: 0.78rem; }
.last-interaction-card .info-value > .seg-source { width: 100%; }
.info-card strong { font-weight: 600; }

/* Sortable table headers */
.th-sortable, th.th-sortable { cursor: pointer; user-select: none; transition: background 0.08s; }
.th-sortable:hover { background: var(--bg) !important; color: var(--accent); }
.th-sorted { color: var(--accent); }
.sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  min-width: 12px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.85rem 0 0.4rem;
  margin-top: 0.5rem;
}
.pagination-info {
  font-size: 0.85rem;
  color: var(--text);
  font-family: ui-monospace, monospace;
}
.pagination button { min-width: 100px; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:disabled:hover { color: var(--text); border-color: var(--border); }




/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-elev-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
