/* ==========================================================================
   Gestão IHO — layout no padrão do Projeto IHO (menu lateral branco com
   seções, barra superior em cartão, cartões com sombra suave, Montserrat),
   nas cores da IHO Soluções: preto e grafite, tirados do losango da logo.
   ========================================================================== */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --border: #e2e2e6;
  --border-strong: #c7c8ce;
  --text: #17171a;            /* títulos e valores */
  --text-body: #45464e;       /* texto corrido */
  --text-muted: #8a8b93;
  --primary: #17171a;
  --primary-dark: #000000;
  --on-primary: #ffffff;
  --accent: #5d6273;          /* grafite azulado da logo: títulos de seção, detalhes */
  --brand-gradient: linear-gradient(135deg, #5d6273 0%, #26272e 48%, #08080a 100%);
  --tint: rgba(23, 23, 26, 0.06);
  --tint-strong: rgba(23, 23, 26, 0.1);
  --table-head-bg: #17171a;
  --table-head-text: #ffffff;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --card-border: transparent;
  --sidebar-bg: #ffffff;
  --avatar-bg: #e6e6ea;
  --avatar-text: #3a3b42;
  --column-bg: #efeff2;
  --drag-over-bg: #e2e2e7;
  --radius-card: 8px;
  --radius-field: 6px;

  --dot-ativo: #22c55e;
  --dot-morno: #9ca3af;
  --dot-frio: #7dd3fc;
}

:root[data-theme="dark"] {
  --bg: #141416;
  --surface: #1f1f23;
  --border: #33333a;
  --border-strong: #4a4a52;
  --text: #f4f4f5;
  --text-body: #d4d4d8;
  --text-muted: #a1a1aa;
  --primary: #f4f4f5;
  --primary-dark: #ffffff;
  --on-primary: #111113;
  --accent: #a4a9ba;
  --brand-gradient: linear-gradient(135deg, #ffffff 0%, #d9dbe2 55%, #a4a9ba 100%);
  --tint: rgba(255, 255, 255, 0.06);
  --tint-strong: rgba(255, 255, 255, 0.1);
  --table-head-bg: #2a2a30;
  --table-head-text: #f4f4f5;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --card-border: #2a2a30;
  --sidebar-bg: #1a1a1d;
  --avatar-bg: #2e2e34;
  --avatar-text: #d4d4d8;
  --column-bg: #19191c;
  --drag-over-bg: #2a2a30;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416;
    --surface: #1f1f23;
    --border: #33333a;
    --border-strong: #4a4a52;
    --text: #f4f4f5;
    --text-body: #d4d4d8;
    --text-muted: #a1a1aa;
    --primary: #f4f4f5;
    --primary-dark: #ffffff;
    --on-primary: #111113;
    --accent: #a4a9ba;
    --brand-gradient: linear-gradient(135deg, #ffffff 0%, #d9dbe2 55%, #a4a9ba 100%);
    --tint: rgba(255, 255, 255, 0.06);
    --tint-strong: rgba(255, 255, 255, 0.1);
    --table-head-bg: #2a2a30;
    --table-head-text: #f4f4f5;
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --card-border: #2a2a30;
    --sidebar-bg: #1a1a1d;
    --avatar-bg: #2e2e34;
    --avatar-text: #d4d4d8;
    --column-bg: #19191c;
    --drag-over-bg: #2a2a30;
  }
}

/* Identidade visual por empresa (módulo Negócios): troca a cor de destaque
   e o cabeçalho das tabelas; o texto sobre a cor é sempre branco. */
.app-shell[data-company-theme] { --on-primary: #ffffff; --table-head-text: #ffffff; --brand-gradient: var(--primary); }
.app-shell[data-company-theme="mcs"] { --primary: #1f6feb; --primary-dark: #1755bb; --accent: #6b7280; }
.app-shell[data-company-theme="reallplay"] { --primary: #ff2e63; --primary-dark: #d31d4c; --accent: #7b2ff7; }
.app-shell[data-company-theme="deskon"] { --primary: #17c964; --primary-dark: #0aa34f; --accent: #0aa34f; }
.app-shell[data-company-theme="podeducar"] { --primary: #e0272e; --primary-dark: #b81f25; --accent: #1a1a1a; }
.app-shell[data-company-theme="highmusic"] { --primary: #d21f1f; --primary-dark: #a91818; --accent: #e4b73c; }
.app-shell[data-company-theme="prosperum"] { --primary: #2b2b2b; --primary-dark: #111111; --accent: #6b6b6b; }
.app-shell[data-company-theme="ihosolucoes"] { --primary: #2c2c2c; --primary-dark: #111111; --accent: #565656; }
.app-shell[data-company-theme="ihoseguros"] { --primary: #2b6cff; --primary-dark: #1d4fc4; --accent: #7b2ff7; }
.app-shell[data-company-theme="ihoturismo"] { --primary: #d6249f; --primary-dark: #a91c7d; --accent: #7b2ff7; }
.app-shell[data-company-theme] { --table-head-bg: var(--primary); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Montserrat", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--text); letter-spacing: -0.01em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Autenticação (login / trocar senha): fundo geométrico grafite + cartão
   branco central, como o AuthShell do Projeto IHO. Sempre no tema claro.
   -------------------------------------------------------------------------- */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #121216 url("/static/img/login-bg.svg") center / cover no-repeat;
  padding: 20px;
  color: #45464e;
}
.auth-card {
  width: 100%; max-width: 401px; background: #ffffff; border-radius: var(--radius-card);
  padding: 34px 40px 30px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35); text-align: center;
  animation: auth-in 0.45s cubic-bezier(.2,.8,.2,1);
}
@keyframes auth-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.auth-logo { width: 96px; height: 96px; object-fit: contain; margin-bottom: 18px; }
.auth-card h1 { color: #17171a; margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: 0.01em; }
.auth-card h1 span { color: #5d6273; font-weight: 500; }
.auth-subtitle { color: #8a8b93; font-size: 13px; margin: 0 0 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.auth-card .form-row label { color: #45464e; font-size: 12px; font-weight: 500; }
.auth-body { color-scheme: light; }
.auth-card .form-row input[type] {
  background: #ffffff; border: 1px solid #d8d8de; color: #17171a;
  height: 40px; padding: 0 14px; border-radius: var(--radius-field); font-size: 14px;
}
.auth-card .form-row input:focus { outline: none; border-color: #17171a; box-shadow: 0 0 0 3px rgba(23,23,26,0.12); }
.auth-card .btn-primary { background: linear-gradient(135deg, #5d6273 0%, #26272e 48%, #08080a 100%); color: #fff; }
.auth-submit { justify-content: center; height: 42px; font-size: 14px; margin-top: 6px; }
.auth-card .field-hint { color: #8a8b93; }
.auth-card .alert-box { text-align: left; }
.alert-list { margin: 6px 0 0; padding-left: 18px; }

/* --------------------------------------------------------------------------
   Estrutura: menu lateral + coluna principal (barra superior + conteúdo)
   -------------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 12px 16px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 0 12px 20px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand-logo { width: 34px; height: 34px; object-fit: contain; }
/* Losango preto da logo some no fundo escuro: no tema escuro ele fica claro. */
:root[data-theme="dark"] .sidebar-brand-logo, :root[data-theme="dark"] .topbar-logo { filter: invert(1) brightness(1.1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar-brand-logo, :root:not([data-theme="light"]) .topbar-logo { filter: invert(1) brightness(1.1); }
}
.sidebar-brand-text { font-size: 16px; font-weight: 500; color: var(--text-muted); }
.sidebar-brand-text strong { color: var(--text); font-weight: 700; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  margin: 16px 0 4px; padding: 4px 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--accent);
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-field);
  color: var(--text-body); font-size: 14px; font-weight: 500;
  cursor: pointer; list-style: none; user-select: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover { background: var(--tint); color: var(--text); text-decoration: none; }
.nav-link > span { flex: 1; min-width: 0; }
.nav-link.active {
  background: var(--brand-gradient); color: var(--on-primary); font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.nav-link.has-active { color: var(--text); font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.nav-chevron { flex-shrink: 0; color: var(--text-muted); transition: transform 0.2s ease; }
.nav-group[open] > summary .nav-chevron { transform: rotate(180deg); }
.nav-children {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 6px 20px; padding-left: 12px; border-left: 1px solid var(--border);
}
.nav-children .nav-link { padding: 7px 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.nav-children .nav-link:hover { color: var(--text); }
.nav-children .nav-link.active { color: var(--on-primary); }
.sidebar-footer { margin-top: auto; padding: 16px 12px 0; font-size: 11px; color: var(--text-muted); }
/* Super Admin: "Ver como" no rodapé do menu; com outro perfil escolhido fica destacado. */
.ver-como {
  margin-top: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-field);
}
.ver-como + .sidebar-footer { margin-top: 0; }
.ver-como label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); }
.ver-como select {
  width: 100%; height: 34px; padding: 0 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-field); background: var(--surface); color: var(--text);
}
.ver-como-ativo { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ver-como-ativo label { color: var(--accent); }

.sidebar-backdrop { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; padding: 20px 24px 32px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow); padding: 10px 20px; min-height: 60px;
  position: sticky; top: 12px; z-index: 50;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { gap: 26px; }
.topbar-logo { width: 30px; height: 30px; object-fit: contain; }
.topbar-divider { width: 1px; height: 28px; background: var(--border); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.breadcrumb-home { display: flex; color: var(--text-muted); }
.breadcrumb-home:hover { color: var(--text); }
.breadcrumb-sep { color: var(--border-strong); font-size: 16px; line-height: 1; }
.breadcrumb-current { color: var(--text); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.topbar-icon-btn:hover { background: var(--tint); color: var(--text); transform: scale(1.06); }
.topbar-menu-btn { display: none; }
#theme-toggle-btn .icon-sun { display: none; }
:root[data-theme="dark"] #theme-toggle-btn .icon-sun { display: block; }
:root[data-theme="dark"] #theme-toggle-btn .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) #theme-toggle-btn .icon-moon { display: none; }
}
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; white-space: nowrap; }
.topbar-user-name { font-size: 14px; font-weight: 500; color: var(--text); }
.topbar-user-role { font-size: 12px; color: var(--text-muted); }
.topbar-avatar {
  position: relative; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5d6273 0%, #26272e 48%, #08080a 100%);
  color: #fff; font-size: 13px; font-weight: 600;
}
.topbar-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.topbar-avatar-dot {
  position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%;
  background: #28c76f; border: 2px solid var(--surface);
}

.content { flex: 1; min-width: 0; max-width: 100%; }

/* Celular / tela estreita: menu vira gaveta */
@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 200; transform: translateX(-100%);
    transition: transform 0.25s ease; box-shadow: 0 0 40px rgba(0,0,0,0.25);
  }
  .app-shell.sidebar-open .sidebar { transform: none; }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,0.4); }
  .topbar-menu-btn { display: inline-flex; }
  .main-col { padding: 12px 16px 24px; }
  .topbar { padding: 8px 12px; top: 8px; }
  .topbar-logo, .topbar-divider, .topbar-user-text { display: none; }
  .topbar-right { gap: 10px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------------
   Cabeçalho de página, botões
   -------------------------------------------------------------------------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-link { color: var(--text-muted); font-size: 13px; display: inline-block; margin-bottom: 4px; }
.back-link:hover { color: var(--text); }

.view-toggle {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-field); overflow: hidden; box-shadow: var(--card-shadow);
}
.view-toggle a { padding: 9px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); transition: background 0.15s ease, color 0.15s ease; }
.view-toggle a:hover { text-decoration: none; color: var(--text); background: var(--tint); }
.view-toggle a.active { background: var(--brand-gradient); color: var(--on-primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 18px; border-radius: var(--radius-field);
  font-family: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: 0.2px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, filter 0.18s ease;
}
.btn-primary {
  background: var(--brand-gradient); color: var(--on-primary);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}
.btn-primary:hover {
  text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26); filter: brightness(1.12);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--tint); border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   Tabelas (cartão sem borda, cabeçalho escuro como no Projeto IHO)
   -------------------------------------------------------------------------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  overflow-x: auto; box-shadow: var(--card-shadow);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; padding: 13px 16px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--table-head-text); font-weight: 600;
  background: var(--table-head-bg); white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-body); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: var(--tint); }
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--accent); }
.row-clickable { cursor: pointer; }

.actions-cell { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
.link-action { background: none; border: none; padding: 0; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--primary); cursor: pointer; }
.link-action:hover { text-decoration: underline; }
.link-danger { color: #ea5455; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--avatar-bg);
}
.avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: var(--avatar-text); background: var(--avatar-bg);
}
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.avatar-lg { width: 88px; height: 88px; font-size: 30px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-ativo { background: var(--dot-ativo); }
.dot-morno { background: var(--dot-morno); }
.dot-frio { background: var(--dot-frio); }

/* Status da conexão: Quente (ATIVO no banco) vermelho, Morno amarelo, Frio azul */
:root { --contato-ativo: #ea4335; --contato-morno: #f5b100; --contato-frio: #3b82f6; }
.dot-contato-ativo { background: var(--contato-ativo); }
.dot-contato-morno { background: var(--contato-morno); }
.dot-contato-frio { background: var(--contato-frio); }
select.status-contato {
  --cor: var(--contato-morno);
  appearance: none; -webkit-appearance: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  height: 30px; padding: 0 30px 0 26px; border-radius: 999px; border: 0;
  color: var(--text); background-color: transparent;
  background-image: radial-gradient(circle, var(--cor) 0 4px, transparent 4.5px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8b93' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 6px center, right 11px center; background-size: 14px 14px, 10px 6px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
select.status-contato:hover { background-color: color-mix(in srgb, var(--text) 6%, transparent); }
select.status-contato:disabled { opacity: 0.6; cursor: wait; }
select.status-contato[data-status="ativo"] { --cor: var(--contato-ativo); }
select.status-contato[data-status="frio"] { --cor: var(--contato-frio); }
select.status-contato option { color: var(--text); background: var(--surface); }
.detail-header-info select.status-contato { margin-top: 6px; }

.temp-badge { padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.temp-quente { background: rgba(234, 84, 85, 0.12); color: #d43f40; }
.temp-morno { background: rgba(138, 139, 147, 0.15); color: #5b5c64; }
.temp-frio { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
:root[data-theme="dark"] .temp-morno { color: #c4c5cc; }

.empty-state {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-card);
  padding: 64px 24px; text-align: center; color: var(--text-muted);
}
.empty-state-icon { font-size: 38px; margin-bottom: 14px; opacity: 0.8; }
.empty-state h2 { color: var(--text); margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.muted { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Formulários
   -------------------------------------------------------------------------- */
.form-card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  padding: 26px 28px; width: 100%; display: flex; flex-direction: column; gap: 20px;
  box-shadow: var(--card-shadow);
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row[hidden] { display: none; }
.form-row label { font-size: 12px; font-weight: 500; color: var(--text-body); }
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="password"],
.form-row input[type="date"], .form-row input[type="number"], .form-row input[type="tel"], .form-row input[type="url"],
.form-row select, .form-row textarea {
  min-height: 38px; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-field);
  font-size: 14px; background: var(--surface); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint-strong);
}
.form-row textarea.textarea-lg { resize: vertical; min-height: 140px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field-hint { color: var(--text-muted); font-size: 12px; }
.input-auto { background: var(--column-bg) !important; color: var(--text-muted) !important; cursor: not-allowed; }

.phone-input-group { display: flex; }
.phone-input-group .phone-prefix {
  display: flex; align-items: center; padding: 0 12px; white-space: nowrap;
  border: 1px solid var(--border); border-right: none; border-radius: var(--radius-field) 0 0 var(--radius-field);
  background: var(--column-bg); color: var(--text-muted); font-size: 14px;
}
.phone-input-group input { border-radius: 0 var(--radius-field) var(--radius-field) 0 !important; flex: 1; min-width: 0; }
.phone-input-group input.phone-ddi {
  flex: 0 0 68px; width: 68px; padding: 0 8px; text-align: center; font-family: inherit;
  border-radius: var(--radius-field) 0 0 var(--radius-field) !important; color: var(--text);
}
.phone-input-group input.phone-ddi:focus { position: relative; z-index: 1; }
.form-grid.cx-local { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .form-grid.cx-local { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

.photo-picker { display: flex; align-items: center; gap: 16px; }

.status-options { display: flex; gap: 20px; flex-wrap: wrap; }
.status-option { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* --------------------------------------------------------------------------
   Detalhe e seções
   -------------------------------------------------------------------------- */
.detail-card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card); padding: 24px;
  margin-bottom: 20px; box-shadow: var(--card-shadow);
}
.detail-header { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.detail-header-info { flex: 1; }
.detail-header-info h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.field-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.6px; font-weight: 600; }
.detail-descricao { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.detail-descricao p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.5; }

.section-card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card); padding: 22px 24px;
  margin-bottom: 20px; box-shadow: var(--card-shadow);
}
.section-card h2 { margin: 0 0 14px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); }
.deals-company-group { margin-bottom: 18px; }
.deals-company-group h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-muted); }
.simple-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.simple-list a { display: flex; align-items: center; gap: 8px; color: var(--text); }

/* --------------------------------------------------------------------------
   Clientes, alertas, filtros, modal
   -------------------------------------------------------------------------- */
.tipo-badge { padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tipo-privado { background: rgba(93, 98, 115, 0.14); color: #4a4e5c; }
.tipo-publico { background: rgba(23, 23, 26, 0.88); color: #ffffff; }
:root[data-theme="dark"] .tipo-privado { color: #c9ccd6; }
:root[data-theme="dark"] .tipo-publico { background: #f4f4f5; color: #17171a; }
.tipo-pessoa_fisica { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.alert-box {
  background: rgba(234, 84, 85, 0.1); border: 1px solid rgba(234, 84, 85, 0.3); color: #c23637;
  padding: 12px 16px; border-radius: var(--radius-field); margin-bottom: 16px; font-size: 14px;
}
.alert-box.alert-success { background: rgba(40, 199, 111, 0.1); border-color: rgba(40, 199, 111, 0.35); color: #1a8a4c; }
.alert-box.alert-info { background: var(--tint); border-color: var(--border); color: var(--text); display: flex; align-items: center; gap: 12px; }
.senha-gerada-box {
  margin-top: 8px; padding: 10px 12px; background: rgba(255,255,255,0.6);
  border-radius: var(--radius-field); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; color: #17171a;
}

.section-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.section-card-header h2 { margin: 0; }

.filter-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-form select, .filter-form input[type="date"] {
  height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-field); font-size: 13px;
  background: var(--surface); color: var(--text); font-family: inherit;
}
.filter-form select:focus { outline: none; border-color: var(--primary); }

.search-bar { position: relative; display: flex; align-items: center; }
.search-bar input[type="search"] {
  height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--border); border-radius: var(--radius-field); font-size: 13px;
  background: var(--surface); color: var(--text); width: 240px; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-bar input[type="search"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint-strong); }
.search-bar-icon {
  position: absolute; left: 12px; width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
}

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(10,10,12,0.55);
  align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal-panel {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  padding: 24px; width: 100%; max-width: 380px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-subtitle { color: var(--text-muted); font-size: 13px; margin: 4px 0 16px; }
.modal-checkbox-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

/* Formulário largo (Cliente / Negócio) */
.form-card-wide { max-width: none; }
.form-grid-3 { grid-template-columns: 1fr 2fr; }
.form-section-title { font-size: 12px; margin: 4px 0 -4px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.form-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* --------------------------------------------------------------------------
   Kanban (cores das etapas mantidas: identificam a fase da esteira)
   -------------------------------------------------------------------------- */
.kanban-scroll { overflow-x: auto; padding-bottom: 20px; }
.kanban-board { display: flex; gap: 24px; align-items: flex-start; }
.kanban-etapa-group { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.kanban-etapa-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 6px 12px; border-radius: var(--radius-field); color: #fff; display: inline-block; width: fit-content;
}
.etapa-1 { background: #0891b2; }
.etapa-2 { background: #3452ff; }
.etapa-3 { background: #f59e0b; }
.etapa-4 { background: #8b5cf6; }
.etapa-5 { background: #16a34a; }
.etapa-0 { background: #6b7280; }

.kanban-fase-columns { display: flex; gap: 12px; }
.kanban-column {
  width: 250px; flex-shrink: 0; background: var(--column-bg); border-radius: var(--radius-card);
  display: flex; flex-direction: column; max-height: 75vh;
}
.kanban-column-header {
  padding: 10px 12px; border-radius: var(--radius-card) var(--radius-card) 0 0; background: var(--surface);
  border-top: 3px solid var(--primary); display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  box-shadow: 0 1px 0 var(--border);
}
.kanban-column-header.etapa-1 { border-top-color: #0891b2; }
.kanban-column-header.etapa-2 { border-top-color: #3452ff; }
.kanban-column-header.etapa-3 { border-top-color: #f59e0b; }
.kanban-column-header.etapa-4 { border-top-color: #8b5cf6; }
.kanban-column-header.etapa-5 { border-top-color: #16a34a; }
.kanban-column-header.etapa-0 { border-top-color: #6b7280; }
.kanban-header-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kanban-fase-tag { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kanban-status-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.kanban-count {
  flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--tint-strong); border-radius: 999px; padding: 2px 8px;
}

.kanban-cards {
  flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 60px;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.kanban-cards.drag-over { background: var(--drag-over-bg); }

.kanban-card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-field); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; cursor: grab; color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kanban-card:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.kanban-card.dragging { opacity: 0.4; }
.kanban-card-title { font-size: 13px; font-weight: 600; }
.kanban-card-cliente { font-size: 12px; color: var(--text-muted); }
.kanban-card-company { font-size: 12px; color: var(--text-muted); }
.kanban-card-vigencia { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.kanban-card-value { font-size: 12px; font-weight: 600; color: var(--text); }

/* --------------------------------------------------------------------------
   Configurações
   -------------------------------------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.settings-card {
  display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); padding: 22px; color: var(--text);
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
a.settings-card:hover {
  border-color: var(--primary); text-decoration: none;
  transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}
.settings-card-icon {
  font-size: 22px; width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--tint-strong);
}
.settings-card h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.settings-card p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.settings-card-count { font-size: 12px; font-weight: 600; color: var(--accent); }
.settings-card-static { cursor: default; }

.theme-switch-row { display: flex; gap: 8px; }
.theme-option {
  height: 34px; padding: 0 14px; border-radius: var(--radius-field); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.theme-option:hover { transform: translateY(-1px); }
.theme-option.active { border-color: transparent; background: var(--brand-gradient); color: var(--on-primary); }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dashboard-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px;
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--card-shadow);
}
.dashboard-filters .form-row { min-width: 190px; gap: 5px; }
.dashboard-filters select {
  height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-field); font-size: 13px;
  background: var(--surface); color: var(--text); font-family: inherit;
}
.dashboard-clear-filters { align-self: center; font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); padding: 20px 22px 20px 26px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-gradient); }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,0.1); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stat-negociando::before { background: #f59e0b; }
.stat-fechado::before { background: #28c76f; }
.stat-perdido::before { background: #ea5455; }

.etapa-tag { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff; display: inline-block; }
.fase-status-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* --------------------------------------------------------------------------
   Seleção de empresa (Negócios)
   -------------------------------------------------------------------------- */
.empresa-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px;
}
.empresa-picker-card {
  /* Fundo sempre branco, então o texto/ícone tem que ser sempre escuro —
     nunca usar var(--text), que vira claro no tema escuro e fica ilegível. */
  background: #ffffff; border: 1px solid #e2e2e6; border-radius: var(--radius-card);
  padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: #17171a; text-align: center; box-shadow: var(--card-shadow);
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.empresa-picker-card:hover {
  transform: scale(1.05); text-decoration: none; border-color: #17171a;
  box-shadow: 0 14px 34px rgba(0,0,0,0.22);
}
.empresa-picker-card img {
  max-width: 100%; height: 72px; object-fit: contain;
}
.empresa-picker-card .empresa-picker-fallback {
  height: 72px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #17171a;
}
.empresa-picker-name { font-size: 14px; font-weight: 600; color: #17171a; }
.empresa-picker-footer { margin-top: 24px; text-align: center; }
.empresa-picker-card { position: relative; }
.empresa-picker-projetos {
  font-size: 11.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #17171a; color: #fff;
}

/* A DeskOn escreve "DESK" em branco — sem contorno fica invisível no card branco. */
.empresa-picker-card img.logo-com-contorno {
  filter:
    drop-shadow(1px 0 0 #17171a)
    drop-shadow(-1px 0 0 #17171a)
    drop-shadow(0 1px 0 #17171a)
    drop-shadow(0 -1px 0 #17171a);
}

/* --------------------------------------------------------------------------
   Fornecedores e Produtos (modelo do Figma "IHO - Admin" › Cadastro)
   -------------------------------------------------------------------------- */
.fn-sugestoes .section-card-header h2 { margin: 0; }
.fn-sugestoes-lista { display: flex; flex-wrap: wrap; gap: 10px; }
.fn-sugestao {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; min-width: 180px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-field); color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.fn-sugestao:hover { text-decoration: none; background: var(--tint); border-color: var(--primary); transform: translateY(-1px); }
.fn-sugestao strong { font-size: 13.5px; }
.fn-sugestao span { font-size: 12px; color: var(--text-muted); }
.fn-sugestao em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--accent); }

.fn-switch {
  position: relative; width: 42px; height: 24px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--border-strong); transition: background 0.2s ease; padding: 0;
}
.fn-switch span {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s ease;
}
.fn-switch.ligado { background: #28c76f; }
.fn-switch.ligado span { transform: translateX(18px); }
.fn-switch:disabled { opacity: 0.7; cursor: wait; }

.fn-menu { position: relative; display: inline-block; }
.fn-menu summary {
  list-style: none; cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-muted);
}
.fn-menu summary::-webkit-details-marker { display: none; }
.fn-menu summary:hover { background: var(--tint); color: var(--text); }
.fn-menu-itens {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 150px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-field);
  box-shadow: 0 12px 30px rgba(0,0,0,0.16); display: flex; flex-direction: column;
}
.fn-menu-itens a, .fn-menu-itens button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 4px; border: none; background: none;
  font-family: inherit; font-size: 13px; color: var(--text); cursor: pointer;
}
.fn-menu-itens a:hover, .fn-menu-itens button:hover { background: var(--tint); text-decoration: none; }
.fn-menu-itens form { margin: 0; }
.fn-menu-itens .link-danger { color: #ea5455; }

.fn-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fn-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fn-grid-rua { grid-template-columns: minmax(0, 2fr) minmax(0, 0.7fr) minmax(0, 1.3fr); }
.fn-usar-cadastro { font-size: 13px; margin-top: -4px; }

/* Assistente em passos */
.wz-tipo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.wz-tipo > span { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.6px; }
.wz-tipo-op { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; cursor: pointer; }
.wz-passos { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0 0 16px; border-bottom: 1px solid var(--border); }
.wz-passos li[data-i] { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text-muted); }
.wz-passos li[data-i] b {
  width: 34px; height: 34px; border-radius: var(--radius-field); display: flex; align-items: center; justify-content: center;
  background: var(--tint-strong); color: var(--text-muted); font-weight: 600; transition: background 0.2s ease, color 0.2s ease;
}
.wz-passos li.atual { color: var(--text); font-weight: 600; }
.wz-passos li.atual b { background: var(--brand-gradient); color: var(--on-primary); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.wz-passos li.feito b { background: rgba(40, 199, 111, 0.16); color: #1a8a4c; }
.wz-seta { color: var(--border-strong); font-size: 20px; }
.wz-passo[hidden] { display: none; }
.wz-passo { display: flex; flex-direction: column; gap: 18px; animation: wz-entra 0.25s ease; }
.pr-cadastro { display: flex; flex-direction: column; gap: 18px; }
@keyframes wz-entra { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.wz[data-tipo="PJ"] .so-pf, .wz[data-tipo="PF"] .so-pj { display: none; }
.wz-acoes { align-items: center; }
.wz-espaco { flex: 1; }
.wz-acoes [hidden] { display: none; }
.wz:not([data-tipo]) .wz-passo + .wz-passo { display: none; }

/* Subcategorias no cadastro do fornecedor (seleção múltipla) */
.fn-subs-linha { grid-column: span 2; }
.fn-subs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 38px; }
.fn-sub { position: relative; cursor: pointer; }
.fn-sub[hidden] { display: none; }
.fn-sub input { position: absolute; opacity: 0; pointer-events: none; }
.fn-sub span {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-body);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.fn-sub span::before { content: "+"; font-weight: 600; color: var(--text-muted); }
.fn-sub:hover span { border-color: var(--border-strong); transform: translateY(-1px); }
.fn-sub input:checked + span { background: var(--brand-gradient); border-color: transparent; color: var(--on-primary); }
.fn-sub input:checked + span::before { content: "✓"; color: inherit; }
.fn-sub input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.fn-subs-vazio { font-size: 12.5px; }

/* CNPJ/CPF obrigatório (sem travar) */
.fn-doc-aviso.pendente { color: #b45309; }
.fn-doc-aviso.erro { color: #ea5455; }
.fn-doc-invalido { border-color: #ea5455 !important; }
.fn-sem-doc {
  display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
  background: rgba(245, 158, 11, 0.16); color: #b45309; font-size: 11px; font-weight: 600; white-space: nowrap;
}
:root[data-theme="dark"] .fn-sem-doc, :root[data-theme="dark"] .fn-doc-aviso.pendente { color: #fbbf24; }
.fn-alerta {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 16px;
  border-radius: var(--radius-card); border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1); color: var(--text); font-size: 13.5px;
}
.fn-alerta > div { flex: 1; }
.fn-ficha-topo .fn-alerta { margin: 12px 0 4px; padding: 10px 12px; gap: 10px; text-align: left; font-size: 12.5px; }
.fn-ficha-topo .fn-alerta a { font-weight: 600; text-decoration: underline; }
.fn-alerta-icone {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: #f59e0b; color: #fff; font-weight: 700;
}

/* Contatos do fornecedor */
.fn-contatos-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fn-contatos { display: flex; flex-direction: column; gap: 12px; }
.fn-contato {
  position: relative; display: grid; grid-template-columns: 1.3fr 1fr 1.3fr 1fr; gap: 14px;
  padding: 14px 44px 14px 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--tint);
}
.fn-contato-x {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: none;
  background: none; color: var(--text-muted); font-size: 18px; cursor: pointer;
}
.fn-contato-x:hover { background: rgba(234, 84, 85, 0.12); color: #ea5455; }
.fn-contato-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--text-body);
  padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.fn-contato-card:last-of-type { border-bottom: none; }
.fn-contato-card strong { color: var(--text); }
.fn-contato-card a, .fn-contato-card > span:not(.dp-pill) { flex-basis: 100%; }
@media (max-width: 900px) { .fn-contato { grid-template-columns: 1fr 1fr; } }

/* Produtos (modelo do Figma › Soluções › Produtos) */
.pr-nome { display: flex; align-items: center; gap: 10px; }
.pr-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #fff; border: 1px solid var(--border); }
.pr-thumb-logo { object-fit: contain; padding: 4px; }
.pr-forn { display: inline-block; margin: 0 6px 2px 0; padding: 1px 8px; border-radius: 999px; background: var(--tint-strong); color: var(--text); font-size: 12px; }
.pr-forn:hover { text-decoration: none; background: var(--border); }
.pr-grid-desc { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.pr-imagem { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pr-imagem-previa {
  width: 72px; height: 72px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border); color: var(--text-muted);
}
.pr-imagem-previa img { width: 100%; height: 100%; object-fit: cover; }
.pr-imagem-previa img.pr-logo-padrao, .pr-capa-imagem img.pr-logo-padrao { object-fit: contain; padding: 10px; }
.pr-imagem .btn { cursor: pointer; }
.pr-remover { font-size: 12.5px; }
.pr-upload {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-card); color: var(--text-body);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pr-upload:hover, .pr-upload.ativo { background: var(--tint); border-color: var(--primary); }
.pr-upload span { font-size: 12px; color: var(--text-muted); }
.pr-upload em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--text); }
.pr-subtitulo { margin: 6px 0 -4px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.pr-ajuda { margin: -6px 0 0; font-size: 13px; color: var(--text-body); }
.pr-checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; }
.pr-checks .status-option { font-size: 13.5px; font-weight: 500; }

.pr-coluna-esq { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 96px; }
.pr-ficha { position: static; }
.pr-arquivos h3 { margin-bottom: 12px; }
.pr-arquivos-grade { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pr-arquivo {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; text-align: center;
  border-radius: var(--radius-field); background: var(--tint); color: var(--text-muted); font-size: 11.5px;
}
.pr-arquivo:hover { text-decoration: none; background: var(--tint-strong); color: var(--text); }
.pr-arquivo span { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pr-arquivo em { font-style: normal; text-transform: lowercase; }
.pr-capa { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.pr-capa-imagem {
  width: 200px; height: 200px; border-radius: var(--radius-card); overflow: hidden; background: #fff; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.pr-capa-imagem img { width: 100%; height: 100%; object-fit: cover; }
.pr-estat { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; margin-bottom: 28px; }
.pr-estat-itens { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 12px; }
.pr-estat-itens .dp-stat > div { min-width: 0; }
.pr-estat-itens .dp-stat strong { white-space: nowrap; }
.pr-estat-itens .dp-stat span.muted { display: block; font-size: 12px; }
.pr-estat-itens .dp-stat strong { font-size: 16px; }
.pr-estat-itens .dp-stat-icone { font-weight: 700; }
.pr-vendas strong { display: block; font-size: 28px; font-weight: 600; color: var(--text); }
.pr-sparkline { width: 100%; height: 56px; color: var(--accent); margin-top: 8px; }
#pr-tabela tr[hidden] { display: none; }
@media (max-width: 1100px) {
  .pr-coluna-esq { position: static; }
  .pr-estat, .pr-capa, .pr-grid-desc { grid-template-columns: 1fr; }
  .pr-checks { grid-template-columns: 1fr 1fr; }
}

/* Negócio: campos exigidos pelo produto */
.ng-exigidos {
  margin-top: 6px; padding: 8px 12px; border-radius: var(--radius-field); font-size: 12.5px;
  background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.4); color: var(--text);
}
.ng-exigidos[hidden] { display: none; }
label.ng-obrigatorio::after { content: " *"; color: #ea5455; font-weight: 700; }

/* Conexões: atuação (etiquetas de mercado) e produtos */
.cx-etiquetas {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px; cursor: text;
  border: 1px solid var(--border); border-radius: var(--radius-field); background: var(--surface);
}
.cx-etiquetas:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint-strong); }
.form-row .cx-etiquetas input[type="text"] {
  flex: 1; min-width: 200px; border: none; box-shadow: none; padding: 4px; min-height: 0; background: transparent;
}
.form-row .cx-etiquetas input[type="text"]:focus { box-shadow: none; }
.cx-etiqueta {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--brand-gradient); color: var(--on-primary); font-size: 12.5px; font-weight: 600;
}
a.cx-etiqueta { padding-right: 10px; }
a.cx-etiqueta:hover { text-decoration: none; filter: brightness(1.15); }
.cx-etiqueta button {
  border: none; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1;
  width: 18px; height: 18px; border-radius: 50%; opacity: 0.8;
}
.cx-etiqueta button:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.cx-etiqueta-mini { font-size: 10.5px; padding: 1px 8px; }
.cx-etiquetas-ver { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cx-todas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; padding: 10px 12px; border-radius: var(--radius-field); background: var(--tint); }
.cx-todas-titulo { width: 100%; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.cx-opcao {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.cx-opcao::before { content: "+"; font-weight: 700; opacity: 0.55; }
.cx-opcao:hover { border-color: var(--text); transform: translateY(-1px); }
.cx-opcao.escolhida { background: var(--brand-gradient); color: var(--on-primary); border-color: transparent; }
.cx-opcao.escolhida::before { content: "✓"; opacity: 1; }
.cx-produtos-grupo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.cx-produtos-empresa { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.cx-atuacao { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .cx-atuacao { grid-template-columns: 1fr; } }

/* Empresas: cartões centralizados e painel da empresa (produtos + esteira) */
.empresa-picker-grid.empresa-picker-centro { display: flex; flex-wrap: wrap; justify-content: center; }
.empresa-picker-centro .empresa-picker-card { width: 200px; }
/* Blocos de 3 cartões, centralizados (a última linha incompleta também fica no meio) */
.empresa-picker-grid.empresa-picker-tres { display: flex; flex-wrap: wrap; justify-content: center; max-width: 700px; margin: 0 auto; }
.empresa-picker-tres .empresa-picker-card { width: 220px; }
@media (max-width: 820px) { .empresa-picker-grid.empresa-picker-tres { max-width: 460px; } }
@media (max-width: 480px) { .empresa-picker-tres .empresa-picker-card { width: min(100%, 260px); } }
.ep-titulo { display: flex; align-items: center; gap: 14px; }
.ep-logo { width: 52px; height: 52px; border-radius: 12px; background: #fff; border: 1px solid #e2e2e6; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ep-logo img { max-width: 80%; max-height: 80%; object-fit: contain; }
.ep-mes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ep-mes strong { font-size: 15px; color: var(--text); min-width: 140px; text-align: center; }
.ep-mes-seta { width: 38px; padding: 0; font-size: 18px; }
.ep-num { display: inline-flex; min-width: 30px; height: 26px; padding: 0 8px; align-items: center; justify-content: center; border-radius: 999px; font-weight: 700; background: rgba(245, 158, 11, 0.16); color: #b45309; }
.ep-num.ep-fechado { background: rgba(40, 199, 111, 0.16); color: #1a8a4c; }
.ep-num.ep-zero { background: var(--tint); color: var(--text-muted); font-weight: 500; }
.ep-produtos tfoot td { font-weight: 700; color: var(--text); border-top: 2px solid var(--border); background: var(--tint); }
.ep-ajuda { display: block; margin-top: 8px; }

/* Conexões › Etiquetas (ranking) e originador automático */
.ce-resumo { margin-left: auto; align-self: center; font-size: 12.5px; color: var(--text-muted); }
.ce-lista { display: flex; flex-direction: column; gap: 8px; }
.ce-item {
  display: grid; grid-template-columns: 36px minmax(140px, 1fr) minmax(120px, 2fr) 120px 16px; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow); color: var(--text); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ce-item:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,0.12); }
.ce-pos { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tint-strong); font-weight: 700; font-size: 13px; }
.ce-nome { font-weight: 600; font-size: 14.5px; }
.ce-barra { height: 10px; border-radius: 999px; background: var(--tint-strong); overflow: hidden; }
.ce-barra span { display: block; height: 100%; border-radius: 999px; background: var(--brand-gradient); min-width: 4px; }
.ce-qtd { font-size: 13px; color: var(--text-muted); text-align: right; }
.ce-qtd strong { font-size: 17px; color: var(--text); margin-right: 3px; }
.ce-seta { color: var(--text-muted); font-size: 18px; }
@media (max-width: 700px) { .ce-item { grid-template-columns: 30px 1fr auto; } .ce-barra, .ce-seta { display: none; } }
.ce-nuvem { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ce-tag {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); color: var(--text);
  font-size: 14px; font-weight: 600; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ce-tag:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 10px 24px rgba(0,0,0,0.14); }
.ce-tag-qtd {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-gradient); color: var(--on-primary); font-size: 13px; font-weight: 700;
}
/* Lista de Conexões: chave Mês/Ano e colunas que ordenam */
.cl-chave { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--tint-strong); height: 38px; align-items: center; }
.cl-chave button {
  border: none; background: none; height: 32px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); transition: background 0.15s ease, color 0.15s ease;
}
.cl-chave button.active { background: var(--brand-gradient); color: var(--on-primary); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.cl-tabela th button {
  border: none; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit;
  text-transform: inherit; letter-spacing: inherit; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.cl-tabela th button::after { content: "↕"; opacity: 0.35; font-size: 12px; }
.cl-tabela th button[data-dir="asc"]::after { content: "↑"; opacity: 1; }
.cl-tabela th button[data-dir="desc"]::after { content: "↓"; opacity: 1; }
.cl-periodo { text-transform: none; font-weight: 500; opacity: 0.8; }
/* Nome ocupa o espaço que sobra (etiquetas lado a lado); período embaixo do título da coluna */
.cl-tabela-larga th button { display: inline-grid; grid-template-columns: auto auto; column-gap: 6px; row-gap: 2px; text-align: left; }
.cl-tabela-larga .cl-periodo { grid-row: 2; grid-column: 1 / -1; font-size: 11px; letter-spacing: 0.2px; }
.cl-tabela-larga th:not(:nth-child(2)), .cl-tabela-larga td:not(:nth-child(2)) { width: 1%; white-space: nowrap; }
.cl-tabela-larga th:nth-child(2) { width: 100%; }
.cl-tabela-larga td:nth-child(2) { min-width: 320px; }
.cl-tabela-larga th button { white-space: normal; }
.cl-tabela-larga th button > span:first-child { white-space: nowrap; }
.cl-tabela-larga td:nth-child(3) { white-space: normal; min-width: 120px; }
.cl-tabela tr[hidden] { display: none; }
.cl-resumo { font-size: 12.5px; margin: 0 0 8px; }
.cl-filtros .form-row { min-width: 150px; }
.cl-filtros-periodo { display: flex; align-items: flex-end; gap: 18px; margin-left: auto; }
.cl-filtros-periodo .form-row { min-width: 0; }
.pe-periodo { justify-content: flex-end; margin-bottom: 14px; }

/* Atuação: sugestões ao digitar e menu de produtos com caixas de seleção */
.cx-etiquetas { position: relative; }
.form-row { position: relative; }
.cx-sugestoes {
  position: absolute; z-index: 40; left: 0; right: 0; padding: 6px; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-field); box-shadow: 0 14px 34px rgba(0,0,0,0.2);
}
.cx-sugestoes[hidden] { display: none; }
#cliente-sugestoes, .fn-sugestoes-campo { top: 100%; margin-top: 4px; }  /* .form-row é flex: sem top, a lista cobriria o campo */
.fn-existente[hidden], #categoria_nova[hidden], .fn-subs-novas[hidden], .pr-cat-nova[hidden] { display: none; }
#categoria_nova, .fn-subs-novas, .pr-cat-nova { margin-top: 8px; }
.fn-existente { justify-content: space-between; flex-wrap: wrap; }
.cx-sugestao { padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.cx-sugestao.marcada, .cx-sugestao:hover { background: var(--tint-strong); }
.cx-sugestao.nova { color: var(--accent); font-weight: 600; border-top: 1px dashed var(--border); margin-top: 4px; }
.cx-multi { position: relative; }
.cx-multi-botao {
  width: 100%; min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-field); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; cursor: pointer; text-align: left;
}
.cx-multi-botao:hover, .cx-multi-botao[aria-expanded="true"] { border-color: var(--primary); }
.cx-multi-seta { color: var(--text-muted); transition: transform 0.15s ease; }
.cx-multi-botao[aria-expanded="true"] .cx-multi-seta { transform: rotate(180deg); }
.cx-multi-painel {
  position: absolute; z-index: 40; left: 0; right: 0; margin-top: 4px; padding: 8px; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-field); box-shadow: 0 14px 34px rgba(0,0,0,0.2);
}
.cx-multi-painel[hidden] { display: none; }
.cx-multi-busca { width: 100%; height: 36px; padding: 0 12px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: var(--radius-field); background: var(--surface); color: var(--text); font-family: inherit; }
.cx-multi-grupo { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.cx-multi-op { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 4px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.cx-multi-op:hover { background: var(--tint); }
.cx-multi-op[hidden] { display: none; }
.cx-multi-op input { width: 16px; height: 16px; }
.cx-multi-escolhidos { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.cx-multi-escolhidos:empty { display: none; }

.cx-originador { min-height: 38px; display: flex; align-items: center; padding: 0 14px; border-radius: var(--radius-field); background: var(--tint); color: var(--text); font-weight: 600; }

/* Categorias de Fornecedores */
.cat-subs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat-sub {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px;
  background: var(--tint-strong); font-size: 12px;
}
.cat-sub.inativa { opacity: 0.55; }
.cat-sub form { margin: 0; display: inline; }
.cat-sub-nome { border: none; background: none; padding: 0; font-family: inherit; font-size: 12px; font-weight: 500; color: var(--text); cursor: pointer; }
.cat-sub-nome:hover { text-decoration: underline; }
.cat-sub-x { border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.cat-sub-x:hover { color: #ea5455; }
.cat-sub-add {
  border: 1px dashed var(--border-strong); background: none; border-radius: 999px; padding: 3px 10px;
  font-family: inherit; font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.cat-sub-add:hover { color: var(--text); border-color: var(--primary); }
.fn-switch-mini { width: 28px; height: 16px; }
.fn-switch-mini span { width: 10px; height: 10px; }
.fn-switch-mini.ligado span { transform: translateX(12px); }
.cat-ajuda { font-size: 12.5px; margin-top: 12px; }

/* Painel lateral (cadastros rápidos) */
.painel-fundo { position: fixed; inset: 0; background: rgba(10, 10, 12, 0.45); z-index: 900; }
.painel-fundo[hidden] { display: none; }
.painel-lateral {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); z-index: 950;
  background: var(--surface); border-radius: var(--radius-card); box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(100% + 24px)); transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
}
.painel-lateral.aberto { transform: none; }
.painel-topo {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
  background: var(--brand-gradient); color: var(--on-primary);
}
.painel-topo h2 { margin: 0; font-size: 16px; font-weight: 500; color: inherit; }
.painel-topo .modal-close { color: inherit; opacity: 0.8; }
.painel-corpo { padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; }
.painel-acoes { display: flex; gap: 10px; }
#painel-pai-linha[hidden] { display: none; }

/* Visualizar Fornecedor */
.fn-detalhe { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.fn-ficha {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow); padding: 24px; position: sticky; top: 96px;
}
.fn-ficha-topo { text-align: center; padding-bottom: 8px; }
.fn-ficha-topo h2 { margin: 0 0 10px; font-size: 24px; font-weight: 600; line-height: 1.2; }
.fn-tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.fn-ficha h3 {
  margin: 20px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
}
.fn-campo { font-size: 13px; color: var(--text-body); margin-bottom: 6px; }
.fn-campo span { font-weight: 600; color: var(--text); }
.fn-obs { font-size: 13px; white-space: pre-wrap; margin: 0; }
.fn-excluir { margin-top: 22px; text-align: center; }
.fn-metricas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.fn-metrica { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fn-metrica strong { display: block; font-size: 22px; font-weight: 600; color: var(--text); }
.fn-metrica span { font-size: 13px; color: var(--text-muted); }
.fn-metrica i {
  font-style: normal; font-size: 20px; width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: var(--tint-strong);
}

@media (max-width: 1100px) {
  .fn-detalhe { grid-template-columns: 1fr; }
  .fn-ficha { position: static; }
  .fn-grid-3, .fn-grid-4, .fn-grid-rua { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .fn-metricas, .fn-grid-3, .fn-grid-4, .fn-grid-rua { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Campos de data em DD/MM/AAAA (ver setupDatasBR em app.js)
   -------------------------------------------------------------------------- */
.data-br { position: relative; display: inline-flex; align-items: center; min-width: 150px; }
.form-row .data-br { display: flex; }
.data-br input[type="text"] {
  width: 100%; height: 38px; padding: 0 38px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-field);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; letter-spacing: 0.3px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.data-br input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint-strong); }
.data-br input[type="text"]:invalid:not(:placeholder-shown) { border-color: #ea5455; }
.data-br-btn {
  position: absolute; right: 4px; width: 30px; height: 30px; border: none; background: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer;
}
.data-br-btn:hover { background: var(--tint); color: var(--text); }
.data-br-nativo { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* --------------------------------------------------------------------------
   Rede de conexões (roda): pessoa no centro, indicados em anéis ao redor.
   Conceito da tela "Filiados › Rede" do protótipo IHO - Admin (Figma).
   -------------------------------------------------------------------------- */
.rede-originadores {
  display: flex; align-items: center; gap: 10px; overflow-x: auto; padding: 2px 2px 14px;
}
.rede-originadores-titulo {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent);
  margin-right: 4px; white-space: nowrap;
}
.rede-orig {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 5px 12px 5px 5px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow);
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.rede-orig:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.rede-orig.active { background: var(--brand-gradient); color: var(--on-primary); border-color: transparent; }
.rede-orig .rede-avatar { width: 30px; height: 30px; font-size: 11px; border-width: 2px; }
.rede-orig em { font-style: normal; font-size: 11px; font-weight: 600; opacity: 0.7; }

.rede-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }

.rede-painel, .rede-palco-card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
.rede-painel { padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 96px; }
.rede-painel-topo { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.rede-painel-topo h2 { margin: 6px 0 0; font-size: 17px; font-weight: 600; }
.rede-painel-topo p { margin: 0; font-size: 12.5px; }
.rede-painel-topo .rede-avatar-painel { width: 96px; height: 96px; font-size: 30px; border-width: 4px; }
.rede-numeros {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.rede-numeros div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rede-numeros strong { font-size: 20px; font-weight: 600; color: var(--text); }
.rede-numeros span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.rede-painel-btn { width: 100%; }

.rede-palco-card { padding: 18px 20px 24px; min-width: 0; }
.rede-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rede-toolbar-right { display: flex; align-items: center; gap: 12px; }
.rede-trilha { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.rede-trilha button {
  background: none; border: none; padding: 2px 0; font-family: inherit; font-size: 13px;
  color: var(--text-muted); cursor: pointer;
}
.rede-trilha button:hover { color: var(--text); text-decoration: underline; }
.rede-trilha-atual { font-size: 18px; font-weight: 600; color: var(--text); }
.rede-filtro { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.rede-filtro select {
  height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-field);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px;
}
.rede-modo { display: flex; border: 1px solid var(--border); border-radius: var(--radius-field); overflow: hidden; }
.rede-modo button {
  width: 38px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: none; color: var(--text-muted); cursor: pointer;
}
.rede-modo button + button { border-left: 1px solid var(--border); }
.rede-modo button.active { background: var(--brand-gradient); color: var(--on-primary); }

.rede-legenda { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 14px 0 4px; font-size: 12px; color: var(--text-muted); }
.rede-legenda > span { display: flex; align-items: center; gap: 6px; }
.rede-legenda-dica { margin-left: auto; font-style: italic; }

/* Avatar com anel na cor do status (como no Figma) */
.rede-avatar {
  --cor: #9ca3af; --fundo: rgba(156, 163, 175, 0.16);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--cor); background: var(--fundo); color: var(--cor);
  font-weight: 700;
}
.rede-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rede-avatar.status-ativo { --cor: var(--contato-ativo); --fundo: rgba(234, 67, 53, 0.14); }
.rede-avatar.status-morno { --cor: var(--contato-morno); --fundo: rgba(245, 177, 0, 0.16); }
.rede-avatar.status-frio  { --cor: var(--contato-frio); --fundo: rgba(59, 130, 246, 0.14); }

.rede-palco-wrap { position: relative; width: 100%; margin-top: 8px; }
/* Responsáveis acima do centro: cadeia vertical do Originador até o indicador direto */
.rede-acima { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 14px auto 0; }
.rede-acima[hidden] { display: none; }
.rede-acima-titulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); margin-bottom: 8px; }
.rede-acima-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 6px 14px 6px 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  font-family: inherit; text-align: left; cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease;
}
.rede-acima-item + .rede-acima-item { margin-top: 18px; }
.rede-acima-item + .rede-acima-item::before {
  content: ""; position: absolute; left: 50%; top: -19px; height: 18px; border-left: 2px dashed var(--border-strong);
}
.rede-acima-item:last-child { margin-bottom: 22px; }
.rede-acima-item:last-child::after {
  content: "↓"; position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%); color: var(--text-muted); font-size: 14px;
}
.rede-acima-item:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.rede-acima-item .rede-avatar { width: 34px; height: 34px; font-size: 12px; border-width: 2px; }
.rede-acima-item > span { display: flex; flex-direction: column; line-height: 1.25; }
.rede-acima-item strong { font-size: 13px; font-weight: 600; }
.rede-acima-item em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.rede-palco { position: absolute; left: 50%; top: 0; transform-origin: top center; }
.rede-svg { position: absolute; inset: 0; pointer-events: none; }
.rede-anel { fill: none; stroke: var(--border); stroke-width: 1.5; stroke-dasharray: 4 6; }
.rede-linha { stroke: var(--border-strong); stroke-width: 1.5; opacity: 0.55; }

.rede-no {
  position: absolute; left: 0; top: 0; width: var(--t); height: var(--t);
  padding: 0; border: none; background: none; cursor: pointer; border-radius: 50%;
  font-family: inherit; font-size: calc(var(--t) * 0.32);
  transform: translate(calc(var(--cx) - 50%), calc(var(--cy) - 50%)) scale(0.2);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1) var(--atraso), opacity 0.4s ease var(--atraso);
}
.rede-pronto .rede-no { transform: translate(calc(var(--x) - 50%), calc(var(--y) - 50%)); opacity: 1; }
.rede-pronto .rede-no:hover { transform: translate(calc(var(--x) - 50%), calc(var(--y) - 50%)) scale(1.12); transition-delay: 0s; z-index: 5; }
.rede-no .rede-avatar { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.rede-centro .rede-avatar { border-width: 6px; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22); }
.rede-centro::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  border: 2px solid var(--border-strong); opacity: 0.6;
}
.rede-nome {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--surface); padding: 1px 8px; border-radius: 999px;
}
.rede-centro .rede-nome { top: calc(100% + 18px); font-size: 14px; padding: 3px 12px; box-shadow: var(--card-shadow); }
.nivel-2 .rede-nome { font-size: 11px; font-weight: 500; }
.rede-badge {
  position: absolute; right: -4px; top: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--brand-gradient); color: var(--on-primary);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.rede-vazio { position: absolute; left: 0; right: 0; text-align: center; color: var(--text-muted); font-size: 13px; margin: 0; }

.rede-tooltip {
  position: absolute; z-index: 20; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none;
  display: flex; flex-direction: column; gap: 3px; min-width: 170px;
  background: #17171a; color: #f4f4f5; border-radius: var(--radius-field); padding: 10px 12px;
  font-size: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.rede-tooltip strong { font-size: 13px; }
.rede-tooltip span { display: flex; align-items: center; gap: 6px; color: #c9cad1; }
.rede-tooltip em { color: #8a8b93; font-size: 11px; margin-top: 2px; }
.rede-tooltip[hidden], .rede-palco-wrap[hidden], .rede-lista[hidden] { display: none; }

.rede-lista { margin-top: 12px; display: flex; flex-direction: column; gap: 22px; }
.rede-grupo h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); }
.rede-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rede-cartao {
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  padding: 12px 14px; border-radius: var(--radius-card); border: 1px solid var(--border);
  background: var(--surface); font-family: inherit; color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.rede-cartao:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--card-shadow); }
.rede-cartao .rede-avatar { width: 44px; height: 44px; font-size: 14px; }
.rede-cartao-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rede-cartao-texto strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rede-cartao-texto span { font-size: 12px; color: var(--text-muted); }
.rede-cartao-texto .status-badge { font-size: 11.5px; color: var(--text-body); margin-top: 2px; }

@media (max-width: 1100px) {
  .rede-layout { grid-template-columns: 1fr; }
  .rede-painel { position: static; }
  .rede-legenda-dica { margin-left: 0; width: 100%; }
}

/* --------------------------------------------------------------------------
   Dashboard (modelo do Figma "IHO - Admin" › Dashboard)
   -------------------------------------------------------------------------- */
.dp-atalhos { display: flex; gap: 6px; align-self: flex-end; flex-wrap: wrap; }
.dp-atalhos button {
  height: 38px; padding: 0 12px; border-radius: var(--radius-field); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-body); font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.dp-atalhos button:hover { background: var(--tint); transform: translateY(-1px); }

.dp-secao { margin-bottom: 32px; }
.dp-secao-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.dp-secao-topo .dp-titulo { margin: 0; }
.dp-titulo { margin: 0 0 14px; font-size: 22px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; line-height: 1.25; }
.dp-titulo strong { font-weight: 700; }
.dp-titulo span { font-size: 15px; font-weight: 500; color: var(--text-muted); }
.dp-titulo-grande { font-size: 26px; }
.dp-titulo-linha { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dp-titulo-linha .link-action { font-size: 13px; font-weight: 600; }

.dp-card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow); padding: 20px;
}
.dp-card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 500; color: var(--text); }

/* 1) Empresas */
.dp-empresas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.dp-empresa {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card); box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.dp-empresa:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.12); }
.dp-empresa-vazia { opacity: 0.55; }
.dp-empresa-logo {
  width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid #e2e2e6;
  display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 6px;
}
.dp-empresa-logo img { width: 80%; height: 80%; object-fit: contain; }
.dp-empresa-logo b { font-size: 13px; color: #17171a; }
.dp-empresa-nome { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.dp-empresa-num { font-size: 12px; color: var(--text-muted); }
.dp-empresa-num strong { font-size: 26px; font-weight: 600; color: var(--text); margin-right: 4px; }
.dp-empresa-sub { font-size: 11.5px; color: var(--text-muted); }

/* Colunas */
.dp-colunas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.dp-dupla { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 1.5fr); gap: 20px; margin-bottom: 32px; }
.dp-vendas td:nth-child(2), .dp-vendas td:nth-child(4) { white-space: nowrap; }

/* 2) Vendas: linhas escuras como as laranjas do Figma */
.dp-vendas tbody tr { background: var(--brand-gradient); }
.dp-vendas tbody tr td { color: var(--on-primary); border-bottom: 1px solid rgba(255,255,255,0.12); }
.dp-vendas tbody tr td .fase-status-sub { color: inherit; opacity: 0.7; }
.dp-vendas tbody tr .row-link { color: var(--on-primary); text-decoration: underline; }
.dp-vendas tbody tr:hover { background: var(--brand-gradient); filter: brightness(1.15); }
.dp-vendas th { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); }

/* 3) Estatísticas */
.dp-estatisticas { display: flex; flex-direction: column; gap: 16px; }
.dp-stat { display: flex; align-items: center; gap: 12px; }
.dp-stat-icone {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--tint-strong); color: var(--text);
}
.dp-stat strong { display: block; font-size: 20px; font-weight: 600; color: var(--text); line-height: 1.1; }
.dp-stat a { font-size: 12px; color: var(--text-muted); text-decoration: underline; }

/* 4) Medidor */
.dp-resumo { display: flex; flex-direction: column; padding-bottom: 0; }
.dp-medidor { position: relative; width: 100%; max-width: 260px; margin: 0 auto; }
.dp-medidor svg { width: 100%; display: block; overflow: visible; }
.dp-medidor-fundo { fill: none; stroke: var(--tint-strong); stroke-width: 14; stroke-linecap: round; }
.dp-medidor-valor { fill: none; stroke: url(#dp-grad); stroke-width: 14; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
:root[data-theme="dark"] .dp-medidor-valor { stroke: #f4f4f5; }
.dp-medidor-texto { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; flex-direction: column; align-items: center; }
.dp-medidor-texto strong { font-size: 40px; font-weight: 500; color: var(--text); line-height: 1; }
.dp-medidor-texto span { font-size: 12.5px; color: var(--text-body); }
.dp-medidor-texto em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.dp-resumo-rodape { display: grid; grid-template-columns: 1fr 1fr; margin: 16px -20px 0; border-top: 1px solid var(--border); }
.dp-resumo-rodape div { display: flex; flex-direction: column; align-items: center; padding: 14px 8px; gap: 2px; }
.dp-resumo-rodape div + div { border-left: 1px solid var(--border); }
.dp-resumo-rodape span { font-size: 12px; color: var(--text-muted); }
.dp-resumo-rodape strong { font-size: 17px; font-weight: 600; color: var(--text); }

/* 5) Ranking */
.dp-ranking { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.dp-rank {
  grid-column: span 2; display: flex; flex-direction: column; gap: 6px; padding: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card); box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.dp-rank:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.14); }
.dp-rank-grande { grid-column: span 3; padding: 20px; min-height: 170px; justify-content: space-between; }
.dp-rank-1 { background: var(--brand-gradient); color: #fff; border-color: transparent; }
.dp-rank-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dp-rank .rede-avatar { width: 40px; height: 40px; font-size: 14px; }
.dp-rank-grande .rede-avatar { width: 56px; height: 56px; font-size: 18px; }
.dp-rank-pos { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: right; }
.dp-rank-1 .dp-rank-pos, .dp-rank-1 .dp-rank-nome { color: rgba(255,255,255,0.8); }
.dp-rank-valor { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.dp-rank-valor small { font-size: 0.55em; margin-right: 2px; }
.dp-rank-grande .dp-rank-valor { font-size: 38px; }
.dp-rank-nome { font-size: 12px; color: var(--text-muted); }
:root[data-theme="dark"] .dp-rank-1 { color: #111113; }
:root[data-theme="dark"] .dp-rank-1 .dp-rank-pos, :root[data-theme="dark"] .dp-rank-1 .dp-rank-nome { color: rgba(17,17,19,0.7); }

/* 6) Conversão por empresa */
.dp-conversao { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; margin-bottom: 18px; }
.dp-conversao-info { display: flex; flex-direction: column; gap: 4px; padding-right: 18px; border-right: 2px solid var(--cor); }
.dp-empresa-logo-grande { width: 64px; height: 64px; border-radius: 14px; }
.dp-conversao-nome { font-size: 17px; font-weight: 600; color: var(--cor); margin-bottom: 8px; }
:root[data-theme="dark"] .dp-conversao-nome { color: var(--text); }
.dp-conversao-rotulo { font-size: 12px; color: var(--text-muted); }
.dp-conversao-mes { display: flex; flex-direction: column; font-size: 12px; color: var(--text-muted); }
.dp-conversao-mes b { font-size: 14px; color: var(--text); font-weight: 600; }
.dp-grafico { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.dp-barras { display: flex; align-items: stretch; justify-content: space-around; height: 190px; gap: 6px; }
.dp-barra-col { flex: 1; display: flex; flex-direction: column; align-items: center; max-width: 46px; }
.dp-barra-cima, .dp-barra-baixo { flex: 1; width: 12px; display: flex; position: relative; }
.dp-barra-cima { align-items: flex-end; border-bottom: 1px solid var(--border); flex-grow: 1.4; }
.dp-barra-baixo { align-items: flex-start; }
.dp-barra-cima span, .dp-barra-baixo span {
  display: block; width: 100%; min-height: 0; border-radius: 6px; position: relative;
  transition: height 0.8s cubic-bezier(.2,.8,.2,1);
}
.dp-barra-cima span { background: var(--cor); }
.dp-barra-baixo span { background: #ea5455; }
.dp-barra-cima i, .dp-barra-baixo i {
  position: absolute; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--text-muted);
}
.dp-barra-cima i { top: -16px; }
.dp-barra-baixo i { bottom: -16px; }
.dp-barra-col em { font-style: normal; font-size: 11px; color: var(--text-muted); margin-top: 18px; }
.dp-legenda { display: flex; gap: 16px; justify-content: center; margin-top: 10px; font-size: 12px; color: var(--text-body); }
.dp-legenda span { display: flex; align-items: center; gap: 6px; }
.dp-legenda i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dp-legenda i.dp-perdido { background: #ea5455; }

/* 7) Negociações */
.dp-filtros-tabela { display: flex; gap: 14px; flex-wrap: wrap; }
.dp-filtros-tabela .form-row { min-width: 240px; }
.dp-filtros-tabela .form-row > span { font-size: 12px; color: var(--text-muted); }
.dp-filtros-tabela input, .dp-filtros-tabela select {
  height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-field);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px;
}
.dp-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.dp-pill-neutra { background: var(--tint-strong); color: var(--text-body); }
.dp-pill-fechado { background: rgba(40, 199, 111, 0.14); color: #1a8a4c; }
.dp-pill-perdido { background: rgba(234, 84, 85, 0.12); color: #c23637; }
.dp-pill-negociando { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.dp-acao { color: var(--text-muted); font-size: 18px; text-align: center; }
.dp-ver-todos { display: flex; justify-content: center; margin-top: 16px; }
#dp-tabela tr[hidden] { display: none; }

@media (max-width: 1200px) {
  .dp-colunas { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .dp-dupla { grid-template-columns: 1fr; }
  .dp-rank, .dp-rank-grande { grid-column: span 6; }
  .dp-conversao { grid-template-columns: 1fr; }
  .dp-conversao-info { border-right: none; border-bottom: 2px solid var(--cor); padding: 0 0 12px; }
}

/* Seletor de mês (_periodo.html): tudo abre no mês vigente, histórico pelo menu */
.periodo { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.periodo-seta { width: 38px; height: 38px; padding: 0; font-size: 18px; }
.periodo-select {
  height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-field);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.periodo-voltar { font-size: 13px; }
.periodo-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 16px; }
.periodo-topo .periodo-legenda { font-size: 12.5px; color: var(--text-muted); }

/* Produto › Negócios por etapa (cartões com ícone; clicar filtra a esteira) */
.pr-etapas { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
.pr-etapa {
  --cor: #6b7280; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 14px 14px;
  border: 1px solid var(--card-border); border-top: 4px solid var(--cor); border-radius: var(--radius-card); background: var(--surface);
  box-shadow: var(--card-shadow); color: var(--text); font-family: inherit; text-align: left; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pr-etapa:hover { transform: translateY(-2px); }
.pr-etapa-1 { --cor: #0891b2; }
.pr-etapa-2 { --cor: #3452ff; }
.pr-etapa-3 { --cor: #f59e0b; }
.pr-etapa-4 { --cor: #8b5cf6; }
.pr-etapa-5 { --cor: #16a34a; }
.pr-etapa-0 { --cor: #ea5455; }
.pr-etapa-icone {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px;
  color: var(--cor); background: color-mix(in srgb, var(--cor) 14%, transparent);
}
.pr-etapa-rotulo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); }
.pr-etapa-nome { font-size: 14px; font-weight: 600; }
.pr-etapa-qtd { font-size: 28px; font-weight: 700; line-height: 1.1; margin-top: 6px; color: var(--cor); }
.pr-etapa-qtd small { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.pr-etapa-valor { font-size: 13px; color: var(--text-body); }
.pr-etapa-fases { display: flex; flex-direction: column; gap: 3px; width: 100%; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.pr-etapa-fases > span { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.pr-etapa-fases b { color: var(--text); font-weight: 600; }
.pr-etapa-fases em { font-style: normal; font-weight: 600; color: var(--text); }
.pr-etapa-vazia .pr-etapa-qtd { color: var(--text-muted); }

/* Esteira de produção do produto (produto_esteira.html) */
.pr-etapa-concluido { --cor: #d4a017; }
.pr-etapa-perdidos { --cor: #ea5455; }
.pr-etapa-ativa { outline: 2px solid var(--cor); outline-offset: 2px; transform: translateY(-2px); }
.abas { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 8px 0 18px; }
.abas button {
  position: relative; border: none; background: none; padding: 12px 16px; font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-radius: var(--radius-field) var(--radius-field) 0 0;
}
.abas button:hover { color: var(--text); background: var(--tint); }
.abas button.active { color: var(--text); }
.abas button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--brand-gradient); }
.abas button em { font-style: normal; font-size: 11px; padding: 1px 7px; margin-left: 4px; border-radius: 999px; background: var(--tint-strong); }
.aba-painel[hidden] { display: none; }
.pe-vazia {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 42px 20px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: var(--radius-card);
}
.pe-vazia strong { color: var(--text); font-size: 15px; }
.pe-vazia span { font-size: 13px; }
.pe-dados .fn-tags { margin-bottom: 14px; justify-content: flex-start; }
.pe-dados-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px 28px; }
.pe-dados-grade h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); }
.pe-vazia[hidden], #pe-esteira[hidden], #pe-esteira .table-wrap[hidden] { display: none; }
#pe-tabela td:last-child, #pe-tabela th:last-child { white-space: nowrap; text-align: right; }

/* ===== Conexões › Mapa (Brasil → estado → cidades) ===== */
.mapa-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.mapa-card, .mapa-painel {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-card); box-shadow: var(--card-shadow);
}
.mapa-card { padding: 18px 20px 20px; min-width: 0; }
.mapa-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.mapa-trilha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.mapa-trilha strong { font-size: 16px; font-weight: 600; color: var(--text); }
.mapa-trilha .muted { font-size: 12.5px; }
.mapa-trilha a { font-weight: 600; }
.mapa-legenda { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-muted); }
.mapa-legenda span { margin: 0 4px; }
.mapa-legenda i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }

.mapa-palco { position: relative; width: 100%; max-width: 760px; margin: 0 auto; }
.mapa-palco svg { display: block; width: 100%; height: auto; overflow: visible; }
.mapa-carregando { padding: 120px 0; text-align: center; color: var(--text-muted); }
.mapa-carregando[hidden] { display: none; }

/* Escala de cor: grafite da identidade, mais escuro = mais conexões */
:root { --mapa-0: #e9eaee; --mapa-1: #d6d8df; --mapa-2: #aeb2bf; --mapa-3: #80869a; --mapa-4: #4d5263; --mapa-5: #1f2029; }
:root[data-theme="dark"] { --mapa-0: #2e2f36; --mapa-1: #464957; --mapa-2: #656a7d; --mapa-3: #8d93a9; --mapa-4: #bcc0cd; --mapa-5: #eceef3; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --mapa-0: #2e2f36; --mapa-1: #464957; --mapa-2: #656a7d; --mapa-3: #8d93a9; --mapa-4: #bcc0cd; --mapa-5: #eceef3; }
}
.mapa-nivel-0 { fill: var(--mapa-0); background: var(--mapa-0); }
.mapa-nivel-1 { fill: var(--mapa-1); background: var(--mapa-1); }
.mapa-nivel-2 { fill: var(--mapa-2); background: var(--mapa-2); }
.mapa-nivel-3 { fill: var(--mapa-3); background: var(--mapa-3); }
.mapa-nivel-4 { fill: var(--mapa-4); background: var(--mapa-4); }
.mapa-nivel-5 { fill: var(--mapa-5); background: var(--mapa-5); }

.mapa-area { stroke: var(--surface); stroke-width: 1.2; cursor: pointer; transition: fill 0.15s ease, opacity 0.15s ease; outline: none; }
.mapa-municipio { stroke-width: 0.5; cursor: default; }
.mapa-municipio:not(.mapa-nivel-0) { cursor: pointer; }
.mapa-area:hover, .mapa-area:focus-visible { fill: var(--accent); stroke: var(--text); stroke-width: 2; paint-order: stroke; }
.mapa-municipio:hover { stroke-width: 1; }
.mapa-municipio.mapa-nivel-0:hover { fill: var(--mapa-1); }
.mapa-municipio.ativo { fill: var(--accent); stroke: var(--text); stroke-width: 1.2; }

.mapa-marcadores { position: absolute; inset: 0; pointer-events: none; }
.mapa-selo {
  position: absolute; transform: translate(-50%, -50%); padding: 2px 7px; border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 10.5px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.mapa-selo b { font-weight: 700; }
.mapa-pino {
  position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 3px; border: 0; border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mapa-pino::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-bottom: 0; border-top-color: var(--surface);
}
.mapa-pino b { font-size: 12px; font-weight: 700; }
.mapa-pino:hover, .mapa-pino.ativo { transform: translate(-50%, -100%) scale(1.12); z-index: 2; }
.mapa-pino.ativo { background: var(--primary); color: var(--on-primary); }
.mapa-pino.ativo::after { border-top-color: var(--primary); }

.mapa-fotos { display: inline-flex; align-items: center; }
.mapa-fotos .rede-avatar { width: 24px; height: 24px; font-size: 9px; border-width: 2px; }
.mapa-fotos .rede-avatar + .rede-avatar { margin-left: -8px; }

.mapa-dica {
  position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: 4px;
  padding: 8px 12px; border-radius: var(--radius-field); background: var(--primary); color: var(--on-primary);
  font-size: 12.5px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); max-width: 240px;
}
.mapa-dica[hidden] { display: none; }
.mapa-dica strong { font-size: 13.5px; }
.mapa-dica .mapa-fotos { margin-top: 2px; }

.mapa-painel { padding: 20px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; }
.mapa-painel-topo h2 { margin: 0; font-size: 17px; font-weight: 600; }
.mapa-painel-topo p { margin: 4px 0 0; font-size: 12.5px; }
.mapa-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mapa-item, .mapa-cidade-topo {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-field);
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.mapa-item:hover, .mapa-cidade-topo:hover { background: var(--tint); text-decoration: none; }
.mapa-item-nome { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapa-qtd { min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--tint-strong); font-size: 12px; font-weight: 700; text-align: center; }
.mapa-cidade { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 4px; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.mapa-cidade.ativo { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.mapa-cidade-pessoas { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 6px 8px; }
.mapa-pessoa {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px;
  background: var(--tint); color: var(--text); font-size: 12px; max-width: 100%;
}
.mapa-pessoa:hover { background: var(--tint-strong); text-decoration: none; }
.mapa-pessoa .rede-avatar { width: 26px; height: 26px; font-size: 10px; border-width: 2px; }
.mapa-pessoa span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapa-obs { margin: 0 10px 4px; font-size: 11.5px; }
.mapa-vazio { margin: 0; font-size: 13px; }
.mapa-aviso { margin: 4px 0 0; padding: 10px 12px; border-radius: var(--radius-field); background: var(--tint); font-size: 12px; color: var(--text-body); }

/* Zoom do mapa do estado: muda o viewBox do SVG (redesenho nítido); pinos reposicionados pelo JS */
.mapa-zoom { position: relative; }
.mapa-palco.mapa-com-zoom { overflow: hidden; border-radius: var(--radius-card); }
.mapa-com-zoom .mapa-zoom { overflow: hidden; }
.mapa-palco.mapa-ampliado { cursor: grab; touch-action: none; }
.mapa-palco.mapa-arrastando { cursor: grabbing; user-select: none; }
.mapa-palco.mapa-arrastando .mapa-area { cursor: grabbing; }
.mapa-area { vector-effect: non-scaling-stroke; }
.mapa-pino { transform-origin: 50% 100%; transition: box-shadow 0.15s ease, background 0.15s ease; }
.mapa-rotulos text {
  fill: var(--text-body); text-anchor: middle; dominant-baseline: middle; pointer-events: none; font-weight: 500;
  paint-order: stroke; stroke: var(--surface); stroke-width: 0.3em; stroke-linejoin: round;
}
.mapa-zoom-botoes {
  position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; flex-direction: column; gap: 4px;
}
.mapa-zoom-botoes[hidden], .mapa-zoom-ajuda[hidden] { display: none; }
.mapa-zoom-botoes button {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-field); background: var(--surface); color: var(--text);
  font: inherit; font-size: 18px; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, background 0.15s ease;
}
.mapa-zoom-botoes button:hover { background: var(--tint-strong); transform: translateY(-1px); }
.mapa-zoom-ajuda {
  position: absolute; left: 8px; bottom: 8px; z-index: 3; pointer-events: none; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); color: var(--text-muted); font-size: 11.5px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Coluna da direita: Brasil (ou estado) + Internacional */
.mapa-coluna { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; }
.mapa-coluna .mapa-painel { position: static; max-height: none; overflow: visible; }
.mapa-sigla {
  flex-shrink: 0; min-width: 30px; padding: 2px 6px; border-radius: 4px; text-align: center;
  background: var(--brand-gradient); color: var(--on-primary); font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
}
.mapa-pais.aberto > .mapa-item { background: var(--tint-strong); }
.mapa-pais-cidades { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 4px 10px; }

@media (max-width: 960px) {
  .mapa-layout { grid-template-columns: 1fr; }
  .mapa-painel { position: static; max-height: none; }
  .mapa-coluna { position: static; max-height: none; overflow: visible; }
  .mapa-legenda { display: none; }
}
