/* ============================================================================
 * APPSO CRM — Enterprise Design System (B2G & B2B Revenue Platform)
 * Precision Architecture · Swiss Typographic Grid · Tactile Depth
 * ============================================================================ */

:root {
  /* Surfaces & Canvas */
  --bg-app: #f8fafc;
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-muted: #e2e8f0;
  --bg-elevated: #ffffff;

  /* Executive Obsidian Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-surface: #1e293b;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;

  /* Ink & Typography */
  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Hairlines & Borders */
  --border-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Brand & Semantic Accents */
  --primary: #2563eb;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #059669;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  --info: #0284c7;
  --info-soft: #f0f9ff;
  --info-border: #bae6fd;

  /* Geometry & Elevation */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-xs: 0 1px 2px rgba(9, 13, 22, 0.04);
  --shadow-sm: 0 1px 3px rgba(9, 13, 22, 0.05), 0 1px 2px -1px rgba(9, 13, 22, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(9, 13, 22, 0.07), 0 2px 4px -2px rgba(9, 13, 22, 0.04);
  --shadow-lg: 0 16px 36px -6px rgba(9, 13, 22, 0.14), 0 4px 12px -2px rgba(9, 13, 22, 0.06);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Scrollbars discretas */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.45);
}

.hidden {
  display: none !important;
}

/* ============================================================================
 * Tipografia & Utilitários Estruturais
 * ============================================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.022em;
  color: var(--text-main);
}

.text-xs { font-size: 11.5px; line-height: 1.4; }
.text-sm { font-size: 12.75px; line-height: 1.45; }
.text-muted { color: var(--text-muted); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }

code {
  font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 11.5px;
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* ============================================================================
 * Botões Táteis de Precisão
 * ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  min-height: 38px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}

.btn svg {
  flex-shrink: 0;
}

.ui-icon {
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
}

.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #3e5ce6 0%, #314bd1 100%);
  color: #ffffff;
  border-color: #2942c2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(15, 23, 42, 0.14);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3451d9 0%, #263eb5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 8px rgba(54, 82, 217, 0.24);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-subtle);
  border-color: #94a3b8;
}

.btn-danger {
  background: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  border-color: #9f1239;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 2px rgba(15, 23, 42, 0.1);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #be123c 0%, #9f1239 100%);
}

.btn-success {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #047857;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background-color: rgba(15, 23, 42, 0.05);
  color: var(--text-main);
}

.btn-sm {
  padding: 0 12px;
  height: 32px;
  min-height: 32px;
  font-size: 12px;
  border-radius: 5px;
  gap: 5px;
  line-height: 1;
}

.btn-xs {
  padding: 0 8px;
  height: 24px;
  min-height: 24px;
  font-size: 11px;
  border-radius: 4px;
  gap: 4px;
  line-height: 1;
}

.btn-lg {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
}

.btn-block {
  width: 100%;
}

.btn-link,
.back-to-login-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
}
.btn-link:hover,
.back-to-login-btn:hover {
  color: var(--primary);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.14s ease;
}
.icon-btn:hover {
  background: var(--bg-muted);
  color: var(--text-main);
  border-color: var(--border-strong);
}

/* ============================================================================
 * Controles de Formulário
 * ============================================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="tel"],
input[type="url"],
input:not([type]),
select,
.form-select {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgba(9, 13, 22, 0.02);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  box-sizing: border-box;
}

textarea {
  width: 100%;
  min-height: 86px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgba(9, 13, 22, 0.02);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  line-height: 1.45;
  box-sizing: border-box;
}

.form-select-sm {
  padding: 5px 9px;
  font-size: 12px;
  width: auto;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 82, 217, 0.13);
}

textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

/* ============================================================================
 * Badges Semânticos & Indicadores de Temperatura
 * ============================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}
.badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}
.badge-warning {
  background: var(--warning-soft);
  color: #b45309;
  border-color: var(--warning-border);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}
.badge-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info-border);
}
.badge-neutral {
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

/* Badges de Temperatura com Status Dot Semântico */
.badge-temp-hot,
.badge-temp-warm,
.badge-temp-cold {
  font-weight: 600;
  padding-left: 7px;
}
.badge-temp-hot::before,
.badge-temp-warm::before,
.badge-temp-cold::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.badge-temp-hot {
  background: #fef2f2;
  color: #be123c;
  border-color: #fecdd3;
}
.badge-temp-hot::before {
  background: #e11d48;
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.2);
}

.badge-temp-warm {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.badge-temp-warm::before {
  background: #f59e0b;
}

.badge-temp-cold {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}
.badge-temp-cold::before {
  background: #0ea5e9;
}

/* Seleção de Temperatura no Cadastro */
.temperature-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 42px;
}

.temp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 42px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
  user-select: none;
  box-sizing: border-box;
}

.temp-chip input[type="radio"] {
  display: none;
}

.temp-chip-icon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: #cbd5e1;
}
.temp-cold .temp-chip-icon { background: #0ea5e9; }
.temp-warm .temp-chip-icon { background: #f59e0b; }
.temp-hot .temp-chip-icon { background: #e11d48; }

.temp-chip.temp-cold:hover,
.temp-chip.temp-cold.active {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0369a1;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.14);
}

.temp-chip.temp-warm:hover,
.temp-chip.temp-warm.active {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #b45309;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.temp-chip.temp-hot:hover,
.temp-chip.temp-hot.active {
  background: #fff1f2;
  border-color: #fb7185;
  color: #be123c;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.14);
}

.temp-chip.temp-none:hover,
.temp-chip.temp-none.active {
  background: var(--bg-muted);
  border-color: #94a3b8;
  color: var(--text-main);
  font-weight: 600;
}

/* Alertas */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.75px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  line-height: 1.45;
}
.alert-error { background: var(--danger-soft); color: #991b1b; border-color: var(--danger-border); }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: var(--warning-border); }
.alert-info { background: var(--primary-soft); color: #1e3a8a; border-color: var(--primary-border); }
.alert-success { background: var(--success-soft); color: #065f46; border-color: var(--success-border); }

/* ============================================================================
 * Tela de Autenticação Executiva (Split-Screen)
 * ============================================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  background-color: var(--bg-surface);
}

.auth-split-layout {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  width: 100%;
  min-height: 100vh;
}

.auth-showcase {
  background-color: #070b14;
  background-image:
    radial-gradient(at 15% 15%, rgba(54, 82, 217, 0.25) 0px, transparent 55%),
    radial-gradient(at 85% 85%, rgba(14, 165, 233, 0.12) 0px, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
  color: #f8fafc;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 56px;
}

.showcase-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: #ffffff;
  display: block;
  line-height: 1.1;
}

.showcase-brand-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

.auth-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 14px;
}

.auth-hero-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: #ffffff;
  max-width: 520px;
  margin-bottom: 16px;
}

.auth-hero-desc {
  font-size: 14.5px;
  line-height: 1.65;
  color: #94a3b8;
  max-width: 480px;
}

.auth-showcase-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 40px 0;
}

.showcase-metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  backdrop-filter: blur(8px);
}

.showcase-metric-kicker {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 6px;
}

.showcase-metric-val {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 4px;
}

.showcase-metric-sub {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
}

.auth-showcase-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-card-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 28px;
  background: var(--bg-surface);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4361ee 0%, #2942c2 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 6px rgba(41, 66, 194, 0.35);
  flex-shrink: 0;
}

.brand-mark-sm {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-form-header {
  margin-bottom: 22px;
}

.auth-form-header h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.demo-credentials-box {
  margin-top: 28px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.demo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.14s ease;
}
.chip-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* ============================================================================
 * App Shell & Executive Obsidian Sidebar
 * ============================================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 244px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 90;
  user-select: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-area {
  margin-left: 244px;
  width: calc(100% - 244px);
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.sidebar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -0.015em;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-tenant {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  padding: 6px 10px 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 11px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.14s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(54, 82, 217, 0.18);
  color: #ffffff;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #6366f1;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: color 0.14s ease;
  flex-shrink: 0;
}

.nav-item:hover .nav-icon {
  color: #cbd5e1;
}

.nav-item.active .nav-icon {
  color: #818cf8;
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.015);
}

.user-profile-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
  color: #f8fafc;
  flex-shrink: 0;
}

.user-meta {
  overflow: hidden;
  flex: 1;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
  flex-shrink: 0;
}
.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ============================================================================
 * Main Area & Precision Topbar
 * ============================================================================ */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 244px;
  width: calc(100% - 244px);
  box-sizing: border-box;
}

.topbar {
  height: 58px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  white-space: nowrap;
}

.alerts-pill-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================
 * Command Palette / Omnisearch Bar
 * ============================================================================ */
.global-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 440px;
  min-width: 200px;
  margin: 0 8px;
}

.global-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 5px 10px;
  gap: 8px;
  transition: all 0.16s ease;
}

.global-search-box:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}

.global-search-box:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 82, 217, 0.12);
}

.global-search-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  user-select: none;
}

.global-search-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  font-size: 12.75px;
  width: 100%;
  color: var(--text-primary);
  padding: 2px 0 !important;
  height: auto !important;
  min-height: 24px !important;
}

.global-search-input::placeholder {
  color: var(--text-muted);
  font-size: 12.5px;
}

.global-search-shortcut {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.global-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 480px;
  overflow-y: auto;
  z-index: 1000;
  padding: 6px 0;
  animation: searchFadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes searchFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-section-header {
  padding: 8px 14px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
}
.search-section-header:first-child {
  border-top: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s ease;
  gap: 10px;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-subtle);
}

.search-result-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.search-result-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.search-result-info {
  min-width: 0;
  flex: 1;
}

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-result-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.search-result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.search-empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.search-tips-box {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}
.search-tips-box strong {
  color: var(--text-primary);
}

/* ============================================================================
 * Segmented Control de Mercado (Público B2G / Privado B2B / Consolidado)
 * ============================================================================ */
.market-segmented-control {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.market-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 11.75px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.market-pill-btn:hover {
  color: var(--text-main);
}

.market-pill-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.market-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot-public { background: #3b82f6; }
.dot-private { background: #8b5cf6; }
.dot-hybrid { background: #10b981; }

/* ============================================================================
 * View Container, Cards, KPIs & Data Tables
 * ============================================================================ */
.view-container {
  padding: 20px 28px 36px 28px;
  flex: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  overflow-x: hidden;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  width: 100%;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-icon-badge {
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  color: var(--text-main);
  line-height: 1.15;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.overview-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  width: 100%;
}

@media (max-width: 980px) {
  .overview-grid-2col {
    grid-template-columns: 1fr;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.toolbar-filters input,
.toolbar-filters select {
  width: auto;
  min-width: 148px;
}

.municipality-toolbar { align-items: stretch; }
.municipality-filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.6fr) repeat(3, minmax(125px, 1fr)) auto;
  flex: 1 1 760px;
}
.municipality-filters input,
.municipality-filters select { box-sizing: border-box; width: 100%; min-width: 0; }
.municipality-filters .btn { min-width: 92px; }
.municipality-toolbar > .flex { align-self: center; flex: 0 0 auto; }
@media (max-width: 1180px) {
  .municipality-filters { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}
@media (max-width: 700px) {
  .municipality-filters { grid-template-columns: 1fr; }
  .municipality-toolbar > .flex { width: 100%; }
  .municipality-toolbar > .flex > * { flex: 1; }
}

/* Data Tables (Attio / Stripe Style) */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  vertical-align: middle;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

td strong {
  color: var(--text-main);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.1s ease;
}

tbody tr:hover td {
  background-color: #f8fafc;
}

/* ============================================================================
 * Quadro Kanban Executivo (Linear / Attio Architecture)
 * ============================================================================ */

/* Painel de Comando Superior do Kanban */
.kb-executive-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.kb-bar-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.kb-funnel-Select-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kb-funnel-kicker {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kb-funnel-main-select {
  font-family: var(--font-display);
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
  padding: 5px 10px !important;
  min-width: 240px;
  background-color: var(--bg-subtle) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
}

.kb-pipeline-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.kb-stat-item {
  display: flex;
  flex-direction: column;
}

.kb-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.1;
}

.kb-stat-val {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.kb-stat-currency {
  color: var(--primary);
}

.kb-stat-divider {
  width: 1px;
  height: 22px;
  background: var(--border-color);
}

.kb-bar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-bar-filters {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.kb-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.kb-search-field svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.kb-search-field:focus-within {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 82, 217, 0.12);
}

.kb-search-field input.kanban-search-box {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 7px 0 !important;
  font-size: 12.75px;
  width: 100%;
  min-width: 0;
}

.kb-bar-filters select {
  padding: 7px 10px;
  font-size: 12.5px;
  background-color: var(--bg-subtle);
}

/* Quadro e Colunas */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(var(--kb-cols, 5), minmax(260px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  padding: 2px 2px 10px 2px;
  align-items: start;
  min-height: 0;
}

.kanban-board::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.kanban-board::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}

.kanban-board::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.kanban-column {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: #edf0f5;
  border: 1px solid #dfe4ec;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 255px);
  min-height: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.kanban-column.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.kanban-col-header {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-sizing: border-box;
}

.kanban-col-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kb-col-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.kb-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kb-col-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.kb-col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.kanban-col-totals {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.kb-col-sum {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  overflow-wrap: break-word;
  word-break: break-word;
}

.kb-col-uninformed {
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.kb-col-progress-track {
  width: 100%;
  height: 3px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.kb-col-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.kanban-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 140px;
}

.kb-empty-column {
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.45);
}

/* Cartão Individual do Kanban */
.kanban-card {
  background: var(--bg-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(9, 13, 22, 0.04);
  cursor: grab;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.14s ease, border-color 0.14s ease;
}

.kanban-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.kb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.kb-card-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.kb-card-price-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kb-card-price {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.kb-card-price.is-muted {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.kb-card-del-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.kb-card-del-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.kanban-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.25px;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--text-main);
  margin-bottom: 4px;
  cursor: pointer;
  transition: color 0.12s ease;
  word-break: break-word;
}
.kanban-card-title:hover {
  color: var(--primary);
}

.kanban-card-mun {
  font-size: 11.75px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.kb-mun-sep {
  color: #cbd5e1;
}

/* Tags de Sistemas da APPSO */
.appso-product-tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  max-width: 100%;
}
.appso-product-tag strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appso-product-tag-public {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}
.appso-product-tag-private {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.appso-product-tag-both {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

/* Linha de Decisor / Contato Principal */
.kb-contact-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 4px 6px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  min-width: 0;
}

.kb-contact-row svg {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.kb-contact-text {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}

.kb-contact-text strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Próxima Ação no Cartão Kanban */
.kanban-next-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  margin-bottom: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.kanban-next-action.alert-urgent {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.kanban-next-action.alert-overdue {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.kanban-next-action.alert-missing {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.kb-inline-btn {
  padding: 2px 7px !important;
  font-size: 10.5px !important;
  height: 20px;
}

/* Rodapé de Precisão do Cartão (2 Linhas Alinhadas) */
.kanban-card-meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
}

.kb-meta-owner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.kb-owner-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.kb-owner-avatar {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kb-owner-name {
  font-size: 11.75px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.12s ease;
  flex-shrink: 0;
}
.kanban-card-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Seletor de Etapa Alinhado 100% no Rodapé */
.kb-meta-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px 6px 2px 8px;
  min-width: 0;
  width: 100%;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.kb-meta-stage-row:hover,
.kb-meta-stage-row:focus-within {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 82, 217, 0.12);
}

.kb-stage-mover-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.kb-stage-select {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 3px 2px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  color: var(--text-main) !important;
  text-align: right;
  text-align-last: right;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-stage-select:focus,
.kb-stage-select:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.kb-stage-select option {
  text-align: left;
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 500;
}

/* ============================================================================
 * Abas Internas (Tabs)
 * ============================================================================ */
.notes-ai-assistant { margin-top: 8px; margin-bottom: 12px; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; }
.notes-ai-assistant [hidden] { display: none !important; }
.notes-ai-assistant textarea { width: 100%; margin-top: 6px; }
.tabs-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab-btn {
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.75px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Estado Vazio */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ============================================================================
 * Modal Dialog (Glass Backdrop & Smooth Elevation)
 * ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 150;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog.modal-lg {
  max-width: 960px;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Cadastros usam toda a área de trabalho, preservando o menu lateral. */
.modal-backdrop.workspace-modal {
  left: 244px;
  padding: 0;
  background: var(--bg-surface);
}
.workspace-modal .modal-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}
.workspace-modal .modal-header {
  flex-shrink: 0;
  padding: 18px 24px;
}
.workspace-modal .modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.workspace-modal form {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0;
}
.workspace-form-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
}
.workspace-form-content fieldset,
.workspace-form-content .form-group {
  min-width: 0;
}
.workspace-form-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  gap: 12px;
}
@media (max-width: 820px) {
  .modal-backdrop.workspace-modal { left: 0; }
}
@media (max-width: 640px) {
  .workspace-form-content { padding: 16px; }
  .workspace-form-content .form-row { grid-template-columns: minmax(0, 1fr); }
  .workspace-form-footer { padding: 12px 16px; }
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}

.toast {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.toast-error { background: #be123c; }
.toast-success { background: #047857; }

hr.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

/* ============================================================================
 * Business Intelligence (BI) Executive Suite
 * ============================================================================ */
.bi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.bi-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.bi-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.bi-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bi-kpi-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.bi-kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 12px;
}

.bi-kpi-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.15;
}

.bi-kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.bi-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.bi-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.bi-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
}

.bi-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.bi-panel-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bi-bar-item {
  margin-bottom: 13px;
}
.bi-bar-item:last-child {
  margin-bottom: 0;
}

.bi-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.25px;
  margin-bottom: 5px;
  gap: 8px;
}

.bi-bar-label {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.bi-bar-val {
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.bi-bar-track {
  width: 100%;
  height: 7px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
}

.bi-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-primary { background: linear-gradient(90deg, #4f46e5, #3652d9); }
.fill-success { background: linear-gradient(90deg, #10b981, #059669); }
.fill-warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.fill-danger  { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.fill-purple  { background: linear-gradient(90deg, #8b5cf6, #6d28d9); }
.fill-cyan    { background: linear-gradient(90deg, #0ea5e9, #0284c7); }

/* Funil Visual de Conversão */
.bi-funnel-step {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 9px;
}

.bi-funnel-step-name {
  width: 150px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bi-funnel-bar-container {
  flex: 1;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  height: 30px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.bi-funnel-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.bi-funnel-metric {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.bi-segmented-bar {
  display: flex;
  height: 22px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  gap: 2px;
}

.bi-seg-item {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: width 0.3s ease;
}

/* Focus Ring Acessível */
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.mobile-only {
  display: none;
}

/* ============================================================================
 * Responsividade (Tablet & Mobile)
 * ============================================================================ */
@media (max-width: 980px) {
  .auth-split-layout {
    grid-template-columns: 1fr;
  }
  .auth-showcase {
    display: none;
  }
  .auth-brand {
    display: flex;
  }
  .kb-bar-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .kb-bar-filters {
    grid-template-columns: 1fr;
  }
  .mobile-only {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .topbar {
    padding: 8px 14px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
  }
  .global-search-wrapper {
    order: 2;
    width: 100%;
    max-width: 100%;
    margin: 6px 0;
  }
  .topbar-right {
    order: 3;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
  }
  .market-segmented-control {
    width: 100%;
    display: flex;
  }
  .market-pill-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 4px;
    font-size: 11px;
  }
  .view-container {
    padding: 14px;
  }
  .toolbar-filters input,
  .toolbar-filters select {
    width: 100%;
  }
  .kanban-column {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .kb-floating-dock {
    left: 50%;
  }
  .kb-dock-track-wrap {
    width: 180px;
  }
}

.kb-360-badge-btn {
  padding: 1px 6px !important;
  font-size: 10px !important;
  height: 18px !important;
  border-radius: 4px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}

.kb-360-badge-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.kb-na-text {
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}

.kb-na-title {
  font-size: 11px;
}

.kb-na-meta {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.88;
}

/* ============================================================================
 * Tabela de Atividades — Layout Fixo sem Rolagem Horizontal
 * Situação e Botões Concluir/Cancelar Sempre Visíveis
 * ============================================================================ */
.activities-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.activities-table th,
.activities-table td {
  vertical-align: top;
  padding: 10px 10px;
  overflow: hidden;
}

.activities-table .col-act-main {
  width: 29%;
  min-width: 0;
  line-height: 1.4;
}

.activities-table .act-title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.activities-table .act-title-row .badge {
  flex-shrink: 0;
  margin-top: 1px;
}

.activities-table .act-title-row strong {
  flex: 1 1 120px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-main);
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.activities-table .act-outcome-box {
  background: var(--bg-subtle);
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--text-secondary);
  overflow-wrap: break-word;
  font-size: 11.5px;
}

.activities-table .col-act-entity {
  width: 21%;
  min-width: 0;
  line-height: 1.38;
}

.activities-table .col-act-schedule {
  width: 17%;
  min-width: 0;
}

.activities-table .act-datetime {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.activities-table .col-act-status {
  width: 13%;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.activities-table th.col-act-actions,
.activities-table td.col-act-actions {
  width: 20%;
  min-width: 0;
  text-align: right;
  overflow: visible;
}

.activities-table .act-actions-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.activities-table .act-actions-group .btn-sm {
  padding: 0 9px;
  height: 28px;
  min-height: 28px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 4px;
  white-space: nowrap;
}

.activities-table .act-actions-group .act-btn-complete {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-hover);
}

.activities-table .act-actions-group .act-btn-complete:hover {
  background: var(--primary-hover);
}

.activities-table .act-actions-group .act-btn-cancel {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.activities-table .act-actions-group .act-btn-cancel:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Proporções da Tabela de Atividades na Ficha da Oportunidade (4 colunas) */
.activities-table-4col .col-act-main {
  width: 38%;
}
.activities-table-4col .col-act-schedule {
  width: 22%;
}
.activities-table-4col .col-act-status {
  width: 16%;
}
.activities-table-4col .col-act-actions {
  width: 24%;
}

/* ============================================================================
 * REDESIGN PREMIUM APPSO CRM — LAYOUT SÓBRIO, ZERO OVERFLOW DESKTOP & MOBILE
 * ============================================================================ */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.app-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.main-area {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  margin-left: 244px;
  width: calc(100% - 244px);
  box-sizing: border-box;
}

.view-container {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: 20px 24px 32px;
}

/* Topbar sem corte em telas desktop intermediárias (1280px - 1440px) */
.topbar {
  height: auto;
  min-height: 60px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}

.topbar-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Identificação clara de Mercado: B2G, B2B e Consolidado */
.market-context-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.market-context-public {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.market-context-private {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.market-context-hybrid {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.global-search-wrapper {
  flex: 1 1 200px;
  max-width: 340px;
  min-width: 170px;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.alerts-pill-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Toolbar & Filtros organizados sem estourar largura */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 14px;
  background: #ffffff;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.toolbar-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 460px;
  min-width: 0;
}

.toolbar-filters input[type="text"],
.toolbar-filters input[type="search"] {
  flex: 1 1 190px;
  min-width: 140px;
  max-width: 100%;
}

.toolbar-filters select {
  flex: 0 1 auto;
  min-width: 130px;
  max-width: 100%;
}

/* Utilitários de Truncamento com Reticências e Alinhamento */
.whitespace-nowrap {
  white-space: nowrap;
}

.text-right {
  text-align: right;
}

.cell-truncate {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.entity-name-row .cell-truncate {
  flex: 0 1 auto;
  min-width: 0;
}

.entity-name-row .kb-360-badge-btn {
  flex-shrink: 0;
}

.entity-primary-link {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  font-size: 13.5px;
}

.entity-primary-link:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.table-actions-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: nowrap;
}

.table-actions-group .btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
  height: 27px;
  white-space: nowrap;
}

/* Tabelas Desktop sem Rolagem Horizontal Desnecessária */
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.entities-table,
.contacts-table,
.activities-table,
.overview-priority-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.entities-table th,
.entities-table td,
.contacts-table th,
.contacts-table td,
.activities-table th,
.activities-table td,
.overview-priority-table th,
.overview-priority-table td {
  padding: 10px 10px;
  vertical-align: top;
  overflow: hidden;
}

/* Proporções da Tabela de Empresas / Prefeituras (6 colunas equilibradas) */
.entities-table .col-ent-name {
  width: 28%;
}
.entities-table .col-ent-loc {
  width: 13%;
}
.entities-table .col-ent-owner {
  width: 13%;
}
.entities-table .col-ent-stats {
  width: 16%;
}
.entities-table .col-ent-temp {
  width: 9%;
}
.entities-table th.col-ent-actions,
.entities-table td.col-ent-actions {
  width: 21%;
  text-align: right;
  overflow: visible;
}

/* Proporções da Tabela de Contatos (4 colunas equilibradas, sem rolagem horizontal) */
.contacts-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.contacts-table th,
.contacts-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.contacts-table .col-con-name {
  width: 26%;
}
.contacts-table .col-con-entity {
  width: 22%;
}
.contacts-table .col-con-direct {
  width: 30%;
}
.contacts-table th.col-con-actions,
.contacts-table td.col-con-actions {
  width: 22%;
  text-align: right;
  overflow: visible;
}
.con-name-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.con-entity-link {
  display: inline-block;
  line-height: 1.35;
}
.con-channel-line {
  line-height: 1.4;
  margin-bottom: 2px;
}
.con-actions-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
@media (max-width: 1120px) {
  .contacts-table,
  .contacts-table thead,
  .contacts-table tbody,
  .contacts-table tr,
  .contacts-table td {
    display: block;
    width: 100% !important;
  }
  .contacts-table thead {
    display: none;
  }
  .contacts-table tbody tr {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--bg-surface);
  }
  .contacts-table td {
    border: none;
    padding: 4px 0 !important;
    text-align: left !important;
  }
  .contacts-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .contacts-table td.col-con-name::before,
  .contacts-table td.col-con-actions::before {
    display: none;
  }
  .con-actions-group {
    justify-content: flex-start;
    margin-top: 6px;
  }
}

/* Proporções da Tabela de Prioridades na Visão Geral */
.overview-priority-table .col-ov-title {
  width: 23%;
}
.overview-priority-table .col-ov-entity {
  width: 22%;
}
.overview-priority-table .col-ov-product {
  width: 16%;
}
.overview-priority-table .col-ov-val {
  width: 12%;
  white-space: nowrap;
}
.overview-priority-table .col-ov-owner {
  width: 11%;
}
.overview-priority-table th.col-ov-action,
.overview-priority-table td.col-ov-action {
  width: 16%;
  text-align: right;
}

/* Quebra de linha natural nos cartões do Kanban sem corte */
.kanban-card-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--text-main);
  margin-bottom: 4px;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.kanban-card-mun {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 6px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.kanban-card-mun .kb-mun-name-click {
  display: inline;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  vertical-align: baseline;
}

/* Backdrop para o Menu Lateral Mobile */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .entities-table,
  .contacts-table,
  .overview-priority-table {
    table-layout: auto;
  }
  .table-actions-group {
    flex-wrap: wrap;
  }
}

/* ============================================================================
 * RESPONSIVIDADE MOBILE (<= 820px): MENU RECOLHIDO E TABELAS EM CARTÕES
 * ============================================================================ */
@media (max-width: 820px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .topbar {
    padding: 10px 14px;
    gap: 8px;
  }

  .page-title {
    font-size: 15.5px;
  }

  .global-search-wrapper {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }

  .topbar-right {
    order: 4;
    width: 100%;
    justify-content: space-between;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-card {
    padding: 12px 14px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .toolbar {
    padding: 12px;
    gap: 10px;
  }

  .toolbar-filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    flex: 1 1 100%;
  }

  .toolbar-filters input,
  .toolbar-filters select,
  .toolbar-filters .btn {
    width: 100%;
    flex: none;
  }

  .modal-backdrop {
    padding: 10px;
    align-items: center;
  }

  .modal-dialog {
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 13px 16px;
  }

  .modal-body {
    padding: 16px 14px;
  }

  /* Transformação de tabelas densas em cartões organizados no celular */
  .responsive-card-table thead {
    display: none;
  }

  .responsive-card-table,
  .responsive-card-table tbody {
    display: block;
    width: 100%;
  }

  .responsive-card-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
  }

  .responsive-card-table tbody tr:last-child {
    border-bottom: none;
  }

  .responsive-card-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    text-align: right !important;
    overflow: visible !important;
  }

  .responsive-card-table tbody td:first-child {
    flex-direction: column;
    align-items: flex-start;
    text-align: left !important;
    padding-bottom: 8px !important;
    border-bottom: 1px dashed var(--border-color) !important;
  }

  .responsive-card-table tbody td:not(:first-child)::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    flex-shrink: 0;
    text-align: left;
    padding-top: 1px;
  }

  .responsive-card-table tbody td .cell-truncate {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .responsive-card-table tbody td:last-child {
    padding-top: 8px !important;
    border-top: 1px solid var(--border-subtle) !important;
    align-items: center;
  }

  .responsive-card-table .table-actions-group,
  .responsive-card-table .act-actions-group {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .responsive-card-table .act-actions-group .btn-sm {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
 * KANBAN COMPACTO, MENU ⋮ & PAINEL LATERAL AMPLO (DRAWER) DA OPORTUNIDADE
 * ============================================================================ */

/* Menu de Ações do Card ⋮ */
.kb-card-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-card-menu-wrapper {
  position: relative;
}

.kb-card-menu-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.12s ease;
}

.kb-card-menu-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-color);
  color: var(--text-main);
}

.kb-card-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 5px 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.kb-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.kb-menu-item:hover {
  background: var(--bg-subtle);
}

.kb-menu-item.text-success {
  color: var(--success);
}
.kb-menu-item.text-danger {
  color: var(--danger);
}

.kb-menu-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

.kb-card-middle-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.kb-contact-compact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
  max-width: 100%;
}

.kb-contact-compact svg {
  color: var(--primary);
  flex-shrink: 0;
}

.kanban-card-meta-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.kb-quick-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
}

/* Painel Lateral Amplo da Oportunidade (Drawer) */
.opp-drawer-backdrop {
  position: fixed;
  inset: 0 0 0 244px;
  background: var(--bg-surface);
  display: flex;
  justify-content: flex-end;
  z-index: 120;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.opp-drawer {
  background: var(--bg-surface);
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  border-left: 0;
  overflow: hidden;
}

@keyframes drawerSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.opp-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.opp-drawer-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.opp-drawer-title-group {
  flex: 1;
  min-width: 0;
}

.opp-drawer-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.opp-drawer-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

#drawer-close-btn {
  font-size: 17px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

#drawer-close-btn:hover {
  background: var(--bg-muted);
  color: var(--text-main);
  border-color: #cbd5e1;
}

/* Barra de Ações Rápidas Reorganizada em Grupos Intencionais */
.opp-drawer-actions-toolbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.opp-drawer-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.opp-drawer-actions-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.opp-drawer-actions-secondary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 0;
  border-top: 0;
}

.opp-drawer-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.opp-drawer-pipeline-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.opp-drawer-manage-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.opp-drawer-manage-group .btn-ghost {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-weight: 500;
}

.opp-drawer-manage-group .btn-ghost:hover {
  background: var(--bg-muted);
  border-color: #cbd5e1;
}

.opp-drawer-manage-group .btn-ghost.text-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.opp-drawer-manage-group .btn-ghost.text-danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

.opp-drawer-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.opp-drawer-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
  padding: 0 18px;
  flex-shrink: 0;
  overflow-x: auto;
}

.opp-drawer-tab-btn {
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.opp-drawer-tab-btn:hover {
  color: var(--primary);
}

.opp-drawer-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.opp-drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
}

/* Grade Equilibrada de 6 Campos no Resumo / Detalhes do Projeto */
.opp-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.opp-summary-card {
  margin-bottom: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 74px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.opp-summary-card:hover {
  border-color: #cbd5e1;
}

.opp-field-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.opp-field-edit-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-muted);
  opacity: 0.72;
  flex-shrink: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.opp-summary-card:hover .opp-field-edit-btn,
.opp-field-edit-btn:focus-visible {
  opacity: 1;
}

.opp-field-edit-btn:hover {
  color: var(--primary);
  background: var(--primary-soft, #eff6ff);
}

.opp-inline-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opp-inline-edit-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-surface, #fff);
  color: var(--text-main);
}

.opp-inline-edit-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-change-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.timeline-change-list li {
  margin-bottom: 2px;
}

/* Studio de Campos Personalizados — Wizard 3 Etapas e Tela Sincronizada */
.cf-wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cf-wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle, #f8fafc);
  font-size: 12px;
  color: var(--text-muted);
}

.cf-wizard-step.active {
  border-color: var(--primary);
  background: var(--primary-soft, #eff6ff);
  color: var(--primary);
  font-weight: 600;
}

.cf-wizard-step.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.cf-wizard-step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.cf-wizard-step.active .cf-wizard-step-num {
  background: var(--primary);
  color: #fff;
}

.cf-wizard-step.done .cf-wizard-step-num {
  background: #16a34a;
  color: #fff;
}

.cf-entity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.cf-entity-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  background: var(--bg-surface, #fff);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.cf-entity-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--bg-subtle, #f8fafc);
}

.cf-entity-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft, #eff6ff);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.cf-entity-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cf-placements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cf-placement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-surface, #fff);
}

.cf-placement-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================================================================
 * Otimização da Listagem de Empresas (B2B), Prefeituras (B2G) e Secretarias
 * ============================================================================ */
.entities-toolbar-v2 {
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.entities-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.entities-density-toggle {
  display: inline-flex;
  background: var(--bg-subtle, #f1f5f9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 2px;
  gap: 2px;
}

.entities-density-toggle .btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.entities-density-toggle .btn.active {
  background: var(--bg-surface, #fff);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  font-weight: 600;
}

.entities-list-region {
  position: relative;
  transition: opacity 0.12s ease;
}

.entities-list-region.is-loading {
  opacity: 0.62;
  pointer-events: none;
}

.entities-table-scroll {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  overflow-x: auto;
}

.entities-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle, #f8fafc);
  box-shadow: inset 0 -1px 0 var(--border-color);
}

.table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
}

.table-sort-btn:hover {
  color: var(--primary);
}

.sort-indicator {
  font-size: 10px;
  opacity: 0.45;
}

.sort-indicator.active {
  opacity: 1;
  color: var(--primary);
}

/* Modo Compacto (~52-58px por linha, padding 8-10px, alinhamento vertical) */
.entities-table.entities-table-compact th {
  padding: 9px 10px;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.entities-table.entities-table-compact td {
  padding: 8px 10px;
  height: 54px;
  vertical-align: middle;
  border-bottom: 1px solid #eef2f6;
}

.entities-table.entities-table-compact tbody tr {
  transition: background-color 0.12s ease;
}

.entities-table.entities-table-compact tbody tr:hover {
  background: #f8fafc;
}

.entities-table.entities-table-compact .entity-primary-link {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
}

/* Modo Confortável (mais contexto e respiro) */
.entities-table.entities-table-comfortable th {
  padding: 11px 12px;
}

.entities-table.entities-table-comfortable td {
  padding: 12px;
  vertical-align: middle;
  border-bottom: 1px solid #e2e8f0;
}

.entities-table.entities-table-comfortable tbody tr:hover {
  background: #f8fafc;
}

.entities-table .col-ent-actions {
  width: 112px;
  text-align: right;
}

.entities-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.entities-360-btn {
  min-width: 44px;
  height: 30px;
  padding: 0 10px;
  font-weight: 600;
}

.entity-row-menu {
  position: relative;
  display: inline-block;
}

.entity-row-menu > summary {
  list-style: none;
  cursor: pointer;
}

.entity-row-menu > summary::-webkit-details-marker {
  display: none;
}

.entity-row-menu-trigger {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.entity-row-menu-trigger:hover,
.entity-row-menu[open] .entity-row-menu-trigger {
  background: var(--bg-subtle, #f1f5f9);
  border-color: var(--border-color);
  color: var(--text-main);
}

.entity-row-menu-body {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 184px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14);
  padding: 4px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entity-row-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.entity-row-menu-item:hover {
  background: var(--bg-subtle, #f1f5f9);
}

.entity-row-menu-item.text-danger {
  color: var(--danger, #dc2626);
}

.entity-row-menu-item.text-danger:hover {
  background: #fef2f2;
}

.entities-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.entities-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.entities-pagesize-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entities-pagesize-label select {
  width: auto;
  min-width: 64px;
  padding: 4px 8px;
  height: 30px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .entities-table-scroll {
    max-height: none;
  }
  .entities-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .entities-table.entities-table-compact td {
    height: auto;
  }
}

@media (max-width: 640px) {
  .cf-wizard-steps,
  .cf-entity-grid {
    grid-template-columns: 1fr;
  }
  .cf-placement-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .opp-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Editor de Texto Rico (Rich Text Editor) */
.rich-editor-wrapper {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rich-editor-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.rich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.12s ease;
}

.rich-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-color);
}

.rich-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.rich-editor-toolbar .rich-select {
  flex: 0 0 112px;
  width: 112px;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  height: 32px;
  margin: 0;
  padding: 0 6px;
  font-size: 11.5px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
}

.rich-toolbar-sep,
.rich-divider {
  flex-shrink: 0;
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 4px;
}

.rich-editor-content {
  min-height: 110px;
  max-height: 350px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-main);
  outline: none;
}

.rich-editor-content[contenteditable=true]:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  cursor: text;
  pointer-events: none;
}

.rich-editor-content ul,
.rich-editor-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

.rich-editor-content li {
  margin-bottom: 2px;
}

.rich-editor-content a {
  color: var(--primary);
  text-decoration: underline;
}

.rich-editor-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 8px 0 4px 0;
}

.rich-editor-content h4 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 6px 0 3px 0;
}

/* Timeline e Histórico */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-entry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.12s ease;
}

.timeline-entry-card:hover {
  border-color: #cbd5e1;
}

.timeline-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-entry-content {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-main);
  word-break: break-word;
}

.timeline-entry-content ul,
.timeline-entry-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

.timeline-outcome-pill {
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.timeline-next-pill {
  background: #f0fdf4;
  border-left: 3px solid var(--success);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #166534;
}

@media (max-width: 820px) {
  .opp-drawer-backdrop {
    left: 0;
  }
  .opp-drawer {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .opp-drawer-header {
    padding: 12px 14px;
    gap: 10px;
  }
  .opp-drawer-actions-toolbar {
    padding: 8px 10px;
  }
  .opp-drawer-actions-secondary {
    flex-wrap: wrap;
    gap: 6px;
  }
  .opp-drawer-manage-group {
    margin-left: 0;
  }
}

/* ============================================================================
 * RESPONSIVIDADE DO PIPELINE KANBAN (SEM ROLAGEM HORIZONTAL E GRADE FLUIDA)
 * ============================================================================ */
@media (max-width: 1023px) and (min-width: 641px) {
  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    overflow-x: hidden;
  }
  .kanban-column {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: none;
  }
  .kanban-cards {
    max-height: 480px;
  }
}

@media (max-width: 640px) {
  .kanban-board {
    grid-template-columns: 1fr;
    gap: 14px;
    overflow-x: hidden;
  }
  .kanban-column {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: none;
  }
  .kanban-cards {
    max-height: none;
  }
}


/* Navegacao dos quadros e das etapas: preserva a largura dos cartoes. */
.kb-board-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  margin-bottom: 10px;
  scrollbar-width: auto;
}
.kb-board-tab {
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}
.kb-board-tab.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.kb-board-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kb-stage-navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 6px; }
.kb-stage-scrollbar { width: 100%; overflow-x: auto; overflow-y: hidden; margin-bottom: 8px; scrollbar-width: auto; }
.kb-stage-scrollbar > div { height: 1px; }
.kb-stage-scrollbar::-webkit-scrollbar { height: 12px; }
.kb-stage-scrollbar::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 6px; }
.kb-stage-scrollbar::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; }
.kanban-board {
  grid-template-columns: repeat(var(--kb-cols, 5), minmax(260px, 1fr));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: auto;
}

/* Configuracoes: tabelas legiveis sem comprimir os controles. */
#settings-body, #settings-body .card { min-width: 0; }
#settings-body .card { overflow-x: auto; }
#settings-body table { min-width: 700px; }
#settings-body .card > .flex { flex-wrap: wrap; gap: 12px; }
#settings-body td .flex { flex-wrap: wrap; }
input[type="color"] { width: 64px; height: 42px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); }
.kb-secondary-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.kb-mobile-toggle { display: none; }
@media (max-width: 640px) {
  .kb-mobile-toggle { display: inline-flex; }
  .kb-secondary-actions:not(.is-open) { display: none; }
  .kb-bar-filters:not(.filters-expanded) { display: none; }
}
.stage-question-overlay { z-index: 400; }
.stage-question-dialog { width: 720px; max-width: 100%; }
.stage-question-dialog .modal-body { overflow-y: auto; }
.stage-question-dialog textarea { min-height: 80px; }
@media(max-width:640px) {
 .stage-question-overlay { padding: 12px; }
 .stage-question-dialog { max-height: 94vh; }
}

/* Mapa de automações: os caminhos são botões editáveis, utilizáveis por teclado. */
.automation-map-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; }
.automation-map-toolbar p { max-width:620px; margin:0; }
.automation-map-root { width:fit-content; max-width:100%; padding:12px 20px; border:1px solid var(--primary-border); border-radius:12px; background:var(--primary-soft); color:var(--primary); font-weight:700; margin:0 auto 24px; }
.automation-map-tree { display:grid; gap:18px; padding-left:18px; border-left:2px solid var(--primary-border); }
.automation-map-branch { display:grid; grid-template-columns:minmax(150px,1fr) minmax(0,3fr); gap:22px; position:relative; }
.automation-map-branch::before { content:''; position:absolute; left:-20px; top:26px; width:20px; height:2px; background:var(--primary-border); }
.automation-map-result { display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:5px; padding:14px; border:1px solid var(--primary-border); background:var(--primary-soft); border-radius:12px; overflow-wrap:anywhere; }
.automation-map-result>span, .automation-flow-node>span { font-size:11px; color:var(--text-muted); }
.automation-map-result>strong { font-size:13px; }
.automation-map-paths { display:grid; gap:8px; align-content:center; border-left:2px solid var(--border-color); padding-left:14px; }
.automation-map-path { display:flex; align-items:center; gap:12px; width:100%; padding:14px; text-align:left; background:var(--bg-surface, #fff); color:var(--text-main, #0f172a); border:1px solid var(--border-color); border-radius:10px; font:inherit; font-size:12px; cursor:pointer; overflow-wrap:anywhere; }
.automation-map-path:hover, .automation-map-path:focus-visible { border-color:var(--primary); box-shadow:0 0 0 2px var(--primary-soft); outline:none; }
.automation-map-path strong { font-size:12px; }
.automation-map-path small { display:block; color:var(--text-muted); margin-top:4px; }
.automation-map-board { flex:0 1 28%; color:var(--text-muted); }
.automation-map-edit { margin-left:auto; color:var(--primary); font-size:11px; flex-shrink:0; }
.automation-map-empty { color:var(--text-muted); border-style:dashed; }
.automation-flow { display:flex; align-items:stretch; gap:8px; padding:14px; background:var(--bg-subtle); border-radius:12px; }
.automation-flow-node { flex:1; min-width:0; border:1px solid var(--primary-border); background:var(--primary-soft); padding:12px; border-radius:10px; display:flex; flex-direction:column; justify-content:center; gap:6px; overflow-wrap:anywhere; }
.automation-flow-node strong { font-size:12px; }
.automation-flow-arrow { color:var(--primary); align-self:center; flex-shrink:0; font-size:18px; }
@media (max-width:700px) {
  .automation-map-toolbar { align-items:flex-start; flex-direction:column; }
  .automation-map-branch { grid-template-columns:minmax(0,1fr); gap:10px; }
  .automation-map-paths { margin-left:10px; padding-left:10px; }
  .automation-map-path { flex-wrap:wrap; gap:8px; }
  .automation-map-board { flex-basis:100%; }
  .automation-flow { flex-direction:column; }
  .automation-flow-arrow { transform:rotate(90deg); }
}

/* Rotina comercial: contexto e registro juntos, sem comprimir os campos. */
.call-workspace { display:grid; grid-template-columns:minmax(200px,240px) minmax(0,1fr); gap:18px; align-items:start; margin-bottom:24px; }
.call-contact-context { position:sticky; top:0; padding:18px; display:flex; flex-direction:column; gap:12px; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-subtle); overflow-wrap:anywhere; min-width:0; }
.call-contact-context h4 { font-size:17px; margin:0; line-height:1.35; }
.call-contact-context p { margin:0; }
.call-contact-context .btn { width:100%; white-space:normal; min-height:42px; }
.call-email { font-size:12px; overflow-wrap:anywhere; }
.call-capture-card { min-width:0; margin-bottom:0!important; }
#drawer-add-note-form { display:flex; flex-direction:column; gap:12px; }
#drawer-add-note-form .call-notes-first { order:3; }
#drawer-add-note-form .call-outcome-row { order:4; }
#drawer-add-note-form .call-next-step-card { order:5; }
#drawer-add-note-form .call-save-row { order:6; position:sticky; bottom:0; padding:12px 0 0; background:var(--bg-surface); z-index:2; }
#drawer-add-note-form .call-save-row .btn { min-height:44px; }
.kanban-stale-alert { margin:8px 0; padding:8px 10px; background:var(--warning-soft); color:#92400e; border:1px solid var(--warning-border); border-radius:8px; font-size:12px; }
.duplicate-board-option { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border-color); }
.duplicate-board-option input { width:18px; height:18px; flex-shrink:0; }
.duplicate-board-option small { display:block; color:var(--text-muted); font-size:12px; margin-top:4px; }
.automation-issue-link { display:block; width:100%; margin-top:8px; text-align:left; border:0; background:transparent; text-decoration:underline; cursor:pointer; color:inherit; font-size:12px; }
.automation-map-path-warning { border-color:var(--warning); background:var(--warning-soft); }
.rule-simulation { padding:14px; margin:16px 0; border:1px solid var(--primary-border); border-radius:10px; background:var(--bg-subtle); }
.rule-simulation summary { color:var(--primary); font-weight:600; cursor:pointer; }
.rule-simulation-fields { padding-top:16px; }
.simulation-result { margin-top:12px; overflow-wrap:anywhere; }
.view-container, #view-container, .main-content, .kb-executive-bar { min-width:0; max-width:100%; }
.opp-drawer { width:100%; max-width:100%; flex:1; }
.opp-drawer-body { min-width:0; }
.opp-drawer-actions-row { flex-wrap:wrap; }
.opp-drawer .form-row { grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr)); }
.opp-drawer-tabs-bar { flex-shrink:0; overflow-x:auto; scrollbar-width:thin; }
.opp-drawer-tab-btn { white-space:nowrap; flex-shrink:0; min-height:44px; }
@media(max-width:1050px) { .call-workspace { grid-template-columns:minmax(0,1fr); }.call-contact-context { position:static; display:grid; grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr)); }.call-contact-context .divider { display:none; } }
@media(max-width:640px) {
  .opp-drawer { width:100vw; max-width:100vw; border-radius:0; }
  .opp-drawer-header { padding:14px 12px; }.opp-drawer-body { padding:12px; }
  .opp-drawer-title { font-size:19px; overflow-wrap:anywhere; }.opp-drawer-sub { overflow-wrap:anywhere; }
  .opp-drawer-action-group { flex-wrap:wrap; }.opp-drawer-actions-row .btn { min-height:42px; }
  .call-capture-card { padding:12px; }.call-contact-context { padding:14px; }
  .kanban-board { grid-template-columns:repeat(var(--kb-cols,5),minmax(270px,82vw)); }
  .kb-bar-top { flex-wrap:wrap; }.kb-bar-actions { flex-wrap:wrap; }.kb-funnel-Select-wrap { min-width:0; max-width:100%; }
  .modal-dialog { max-width:calc(100vw - 16px); }.table-wrapper { max-width:100%; overflow-x:auto; }
}

#mun-form > .alert, #contact-form > .alert {max-height:170px;overflow-y:auto;flex-shrink:0;}
.pipeline-builder-rows { display: grid; gap: 12px; }
.pipeline-builder-row { border: 1px solid #dbe3ef; border-radius: 10px; padding: 12px; background: #fff; }
.pipeline-builder-row.pipeline-drop-target { border-color: #3b82f6; background: #eff6ff; }
.pipeline-row-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pipeline-row-heading > .flex { margin-left: auto; }
[data-pipeline-handle] { cursor: grab; touch-action: none; }
[data-pipeline-handle]:active { cursor: grabbing; }
.pipeline-row-fields { display: grid; grid-template-columns: minmax(0, 1fr) 68px; gap: 12px; margin-bottom: 10px; }
.pipeline-row-fields input[type="color"] { width: 100%; min-height: 40px; padding: 3px; }
.pipeline-builder-row label { display: block; font-size: 13px; }
.pipeline-builder-row details label { margin-top: 10px; }
.pipeline-builder-preview { display: flex; overflow-x: auto; gap: 10px; padding: 12px 0; }
.pipeline-preview-column { flex: 0 0 160px; border: 1px solid #dbe3ef; border-radius: 8px; background: #f4f7fb; padding: 12px; min-height: 85px; overflow-wrap: anywhere; }
.pipeline-preview-column strong { display: block; margin-top: 6px; }
@media (max-width: 540px) {
  .pipeline-row-heading { flex-wrap: wrap; }
  .pipeline-row-heading > .flex { flex-wrap: wrap; }
}
.secretariat-overview { min-width: 0; }
.secretariat-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.secretariat-heading h2, .secretariat-heading h3 { margin:0 0 8px; }
.secretariat-card { margin-top:16px; padding:20px; border:1px solid var(--border-color, #dbe3ef); border-radius:12px; background:var(--bg-card, #fff); }
.secretariat-active { border-left:4px solid #4f46e5; background:var(--bg-card, #f8faff); }
.secretariat-project { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:12px; border-top:1px solid var(--border-color, #e2e8f0); padding:16px 0 4px; margin-top:12px; }
.secretariat-project > div:first-child { flex:1 1 260px; overflow-wrap:anywhere; }
.secretariat-closed { margin-top:16px; }
.secretariat-overview summary { cursor:pointer; font-weight:600; padding:8px 0; }
.secretariat-card.secretariat-disclosure { padding:0; }
.secretariat-overview .secretariat-summary, .municipality-data-disclosure > summary { display:flex; align-items:center; flex-wrap:wrap; gap:10px 16px; padding:16px; cursor:pointer; list-style:none; }
.secretariat-summary::-webkit-details-marker, .municipality-data-disclosure > summary::-webkit-details-marker { display:none; }
.secretariat-summary-name { font-weight:700; overflow-wrap:anywhere; }
.disclosure-toggle { margin-left:auto; color:var(--primary, #4f46e5); font-size:13px; font-weight:600; white-space:nowrap; }
.disclosure-toggle::after { content:' +'; }
.disclosure-collapse { display:none; }
.secretariat-disclosure[open] > summary .disclosure-expand, .municipality-data-disclosure[open] > summary .disclosure-expand { display:none; }
.secretariat-disclosure[open] > summary .disclosure-collapse, .municipality-data-disclosure[open] > summary .disclosure-collapse { display:inline; }
.secretariat-disclosure[open] > summary .disclosure-toggle::after, .municipality-data-disclosure[open] > summary .disclosure-toggle::after { content:' −'; }
.secretariat-details { padding:0 16px 16px; }
.municipality-data-disclosure { border:1px solid var(--border-color, #e2e8f0); border-radius:12px; }
.municipality-data-body { padding:0 16px 16px; }
.secretariat-summary:focus-visible, .municipality-data-disclosure > summary:focus-visible { outline:2px solid #4f46e5; outline-offset:3px; border-radius:10px; }
@media(max-width:600px) { .secretariat-card { padding:14px; } .secretariat-heading .btn, .secretariat-project .btn { min-height:40px; } }
.drawer-more-actions { position:relative; }
.drawer-more-actions > summary { list-style:none; cursor:pointer; }
.drawer-more-actions > summary::-webkit-details-marker { display:none; }
.opp-drawer-header { position:relative; z-index:3; }
.drawer-more-actions-body { position:absolute; right:0; top:calc(100% + 6px); width:280px; max-width:calc(100vw - 36px); max-height:60vh; overflow:auto; padding:12px; border:1px solid var(--border-color); border-radius:10px; background:var(--bg-surface); box-shadow:0 12px 32px #0f172a26; z-index:5; }
.drawer-more-actions-body .opp-drawer-actions-secondary, .drawer-more-actions-body .opp-drawer-action-group { display:flex; flex-direction:column; align-items:stretch; width:100%; gap:6px; }
.drawer-more-actions-body .btn { justify-content:flex-start; width:100%; min-height:40px; white-space:normal; text-align:left; }
.drawer-contact-strip { padding-top:10px; border-top:1px solid var(--border-color); }
.drawer-contact-strip > div { display:flex; flex-direction:column; gap:3px; min-width:0; overflow-wrap:anywhere; }
.opportunity-composer { margin-bottom:16px; }
.opportunity-composer > summary { list-style:none; }
.opportunity-composer > summary::-webkit-details-marker { display:none; }
.opportunity-composer-body { margin-top:12px; padding:14px; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-subtle); }
.opportunity-composer .call-workspace { margin:12px 0 0; }
.drawer-timeline-filters { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
.drawer-timeline-filters label { margin:0; font-size:13px; }
.drawer-timeline-filters select { width:auto; max-width:100%; }
.timeline-filter-field { display:flex; flex-direction:column; gap:6px; }
.timeline-filter-field[hidden] { display:none; }
.timeline-filter-field input, .timeline-filter-field select { min-height:40px; }
.drawer-timeline-filters { align-items:flex-end; }
.timeline-filter-help { flex-basis:100%; margin:0; }
.timeline-entry-card[hidden] { display:none; }
.opp-drawer-tabs-bar [role="tab"]:focus-visible, .drawer-more-actions > summary:focus-visible, .opportunity-composer > summary:focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
@media(max-width:780px) {
  .drawer-more-actions-body { position:fixed; top:auto; right:12px; }
}
.cadence-period-toolbar { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; padding:16px; margin-bottom:16px; border:1px solid var(--border-color); border-radius:10px; background:var(--bg-surface); }
.cadence-period-field { display:flex; flex-direction:column; gap:6px; min-width:180px; }
.cadence-period-field label { margin:0; font-size:13px; font-weight:600; }
.cadence-period-toolbar > p { flex-basis:100%; margin:0; }
.cadence-pagination { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:12px; margin-top:16px; }
@media(max-width:600px) { .cadence-period-field { flex:1 1 100%; } }
.cadence-filters-panel { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); align-items:end; gap:12px; padding:14px 16px; margin-bottom:12px; }
.cadence-filters-panel .cadence-period-field { min-width:0; }
.cadence-filters-panel select, .cadence-filters-panel input { width:100%; min-width:0; }
.cadence-filters-panel > p { grid-column:1 / -1; line-height:1.4; }
.cadence-filters-panel #act-clear-filters { min-height:40px; white-space:nowrap; }
.cadence-filter-footer { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.cadence-filter-footer p { margin:0; line-height:1.4; }
.cadence-actions-toolbar { padding:0; border:0; box-shadow:none; background:transparent; margin-bottom:16px; justify-content:flex-end; }
.cadence-page-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.cadence-page-actions .btn { min-height:40px; }
.cadence-activities-table { table-layout:fixed; width:100%; }
.cadence-activities-table .col-act-main { width:38%; }
.cadence-activities-table .col-act-entity { width:26%; }
.cadence-activities-table .col-act-schedule { width:15%; }
.cadence-activities-table .col-act-status { width:9%; }
.cadence-activities-table th.col-act-actions, .cadence-activities-table td.col-act-actions { width:12%; }
.cadence-activities-table .col-act-entity .cell-truncate, .cadence-activities-table .col-act-schedule .cell-truncate { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
.cadence-activities-table .col-act-entity .entity-name-row { align-items:flex-start; }
.cadence-activities-table th { white-space:normal; line-height:1.35; padding:10px 10px; }
.cadence-activities-table td { vertical-align:top; line-height:1.45; padding:10px 10px; overflow-wrap:anywhere; }

/* Agenda compacta (cabeçalho, barra de filtros, preview de histórico e modal) */
.agenda-top-header { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.agenda-tabs-bar { margin-bottom:0; flex:1 1 auto; }
.agenda-primary-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.agenda-primary-actions .btn { min-height:38px; padding:7px 14px; white-space:nowrap; }
.agenda-filter-bar { padding:10px 12px; margin-bottom:12px; border:1px solid var(--border-color); border-radius:10px; background:var(--bg-surface); }
.agenda-filter-bar-main { display:flex; align-items:flex-end; flex-wrap:wrap; gap:10px; }
.cadence-inline-field { display:flex; flex-direction:column; gap:4px; min-width:165px; flex:0 1 210px; }
.cadence-inline-field label { margin:0; font-size:12px; font-weight:600; color:var(--text-muted); }
.cadence-inline-field select, .cadence-inline-field input { min-height:36px; padding:6px 10px; font-size:13px; width:100%; }
.agenda-filter-bar-controls { display:flex; align-items:center; gap:8px; margin-left:auto; }
.agenda-more-active { border-color:var(--primary) !important; color:var(--primary) !important; background:var(--primary-soft) !important; font-weight:600; }
.agenda-more-filters-panel { display:flex; align-items:flex-end; flex-wrap:wrap; gap:10px; margin-top:10px; padding-top:10px; border-top:1px dashed var(--border-color); }
.agenda-more-filters-extra { margin-left:auto; display:flex; align-items:center; }
.act-history-compact { background:var(--bg-subtle); border-left:3px solid var(--primary); padding:6px 8px; border-radius:4px; }
.act-history-preview { font-size:12px; color:var(--text-main); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.45; }
.act-history-compact-footer { display:flex; align-items:center; gap:8px; margin-top:4px; flex-wrap:wrap; }
.act-history-modal-meta { background:var(--bg-subtle); border:1px solid var(--border-color); border-radius:8px; padding:10px 12px; font-size:13px; line-height:1.6; }
.act-history-modal-body { background:var(--bg-surface); border:1px solid var(--border-color); border-radius:8px; padding:12px 14px; font-size:13px; line-height:1.6; max-height:52vh; overflow-y:auto; overflow-wrap:anywhere; }
.act-history-img { display:block; max-width:100%; height:auto; border-radius:8px; margin:8px 0; border:1px solid var(--border-color); }
.act-history-rich { background:var(--bg-subtle); border-left:3px solid var(--primary); padding:8px 10px; border-radius:4px; font-size:12.5px; line-height:1.5; }
@media(max-width:900px) {
  .agenda-filter-bar-controls { margin-left:0; }
  .agenda-more-filters-extra { margin-left:0; }
  .cadence-activities-table { table-layout:auto; }
}
@media(max-width:1200px) { .cadence-filters-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }.cadence-filters-panel #act-clear-filters { justify-self:start; } }
@media(max-width:600px) { .cadence-filters-panel { grid-template-columns:minmax(0,1fr); }.cadence-page-actions { justify-content:stretch; width:100%; }.cadence-page-actions .btn { flex:1 1 auto; } }
.b2g-population-lookup { display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding:12px; border:1px solid var(--border-color); border-radius:10px; margin:0 0 16px; }
.b2g-auto-label { display:flex; align-items:center; gap:8px; font-size:13px; }
.b2g-auto-label input[type="checkbox"] { width:auto; flex:0 0 auto; }
.b2g-population-lookup p { flex-basis:100%; margin:0; }
.b2g-nearby-controls { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; }
.b2g-nearby-controls .form-group { flex:1 1 220px; margin:0; }
.b2g-origin-row { background:#eef2ff; }
.b2g-origin-row .badge { display:block; width:fit-content; margin-top:6px; }
.b2g-municipality-actions { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.kb-nearby-btn { margin:6px 0; min-height:34px; }
[data-b2g-suggestion] { white-space:pre-wrap; line-height:1.6; }
.settings-market-switcher { border:1px solid var(--border-color); background:var(--bg-surface); }
.settings-market-header { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.settings-market-tabs { display:inline-flex; align-items:center; gap:6px; background:var(--bg-muted); border:1px solid var(--border-color); border-radius:10px; padding:4px; }
.settings-market-tab { display:inline-flex; align-items:center; gap:8px; padding:9px 16px; font-family:inherit; font-size:13px; font-weight:600; color:var(--text-muted); background:transparent; border:1px solid transparent; border-radius:8px; cursor:pointer; transition:all 0.14s ease; }
.settings-market-tab:hover { color:var(--text-main); }
.settings-market-tab.active { background:var(--bg-surface); color:var(--text-main); border-color:var(--border-color); box-shadow:var(--shadow-xs); }
.settings-market-tab.active.is-private { border-color:#8b5cf6; color:#6d28d9; }
.settings-market-tab.active.is-public { border-color:#2563eb; color:#1d4ed8; }
.settings-layout { display:grid; grid-template-columns:248px minmax(0, 1fr); gap:20px; align-items:start; }
.settings-nav { position:sticky; top:12px; display:flex; flex-direction:column; gap:18px; padding:14px; background:var(--bg-surface); border:1px solid var(--border-color); border-radius:var(--radius-lg); box-shadow:var(--shadow-xs); }
.settings-nav-group { display:flex; flex-direction:column; gap:6px; }
.settings-nav-group + .settings-nav-group { padding-top:14px; border-top:1px solid var(--border-color); }
.settings-nav-group-header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:0 8px 4px; }
.settings-nav-group-title { font-size:11px; font-weight:700; letter-spacing:0.05em; text-transform:uppercase; color:var(--text-muted); }
.settings-nav-market-pill { font-size:10.5px; font-weight:700; padding:2px 7px; border-radius:999px; white-space:nowrap; }
.settings-nav-market-pill.is-public { background:#dbeafe; color:#1d4ed8; }
.settings-nav-market-pill.is-private { background:#ede9fe; color:#6d28d9; }
.settings-nav-list { display:flex; flex-direction:column; gap:3px; }
.settings-nav-item { width:100%; display:flex; align-items:center; justify-content:space-between; text-align:left; padding:8px 10px; border:1px solid transparent; border-radius:var(--radius-md); background:transparent; color:var(--text-secondary); font-family:inherit; font-size:13px; font-weight:500; cursor:pointer; transition:background 0.14s ease, color 0.14s ease, border-color 0.14s ease; }
.settings-nav-item:hover { background:var(--bg-subtle); color:var(--text-primary); }
.settings-nav-item.active { background:var(--primary-soft); color:var(--primary); border-color:var(--primary-border); font-weight:600; }
.settings-content { min-width:0; display:flex; flex-direction:column; gap:14px; }
.settings-section-header { padding:14px 18px; background:var(--bg-surface); border:1px solid var(--border-color); border-radius:var(--radius-lg); box-shadow:var(--shadow-xs); }
.settings-section-title-row { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.settings-section-title { margin:0; font-size:17px; font-weight:700; color:var(--text-primary); }
.settings-section-actions { display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; }
.settings-help-btn { display:inline-flex; align-items:center; gap:6px; }
.settings-help-icon { display:inline-flex; align-items:center; justify-content:center; width:17px; height:17px; border-radius:999px; background:var(--primary-soft); color:var(--primary); font-size:11px; font-weight:700; line-height:1; }
.settings-help-group-title { margin:0 0 2px; font-size:13px; font-weight:700; color:var(--text-primary); text-transform:uppercase; letter-spacing:0.04em; }
.settings-help-list { display:flex; flex-direction:column; gap:8px; }
.settings-help-item { padding:11px 13px; border:1px solid var(--border-color); border-radius:var(--radius-md); background:var(--bg-subtle); }
.settings-help-item.is-current { border-color:var(--primary-border); background:var(--primary-soft); }
.settings-help-item-head { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-bottom:5px; }
.settings-help-item-title { display:inline-flex; align-items:center; gap:8px; font-size:13.5px; color:var(--text-primary); }
.settings-help-line { margin:3px 0 0; font-size:12.5px; line-height:1.45; color:var(--text-secondary); }
.settings-context-badge { display:inline-flex; align-items:center; gap:7px; padding:4px 11px; border-radius:999px; font-size:12px; font-weight:600; border:1px solid var(--border-color); }
.settings-context-badge.is-public { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.settings-context-badge.is-private { background:#f5f3ff; border-color:#ddd6fe; color:#6d28d9; }
.settings-context-badge.is-shared { background:var(--bg-subtle); border-color:var(--border-color); color:var(--text-secondary); }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns:minmax(0, 1fr); gap:14px; }
  .settings-nav { position:static; }
  .settings-nav-list { flex-direction:row; flex-wrap:wrap; gap:6px; }
  .settings-nav-item { width:auto; padding:7px 11px; border-color:var(--border-color); }
}
/* Chat de relatórios: dados exatos em tabela e barras responsivas. */
.reporting-chat textarea { width:100%; min-height:76px; margin-top:6px; }
.reporting-chat-history { max-height:600px; overflow:auto; }
.reporting-chat-answer { border-top:1px solid var(--border-color,#ddd); padding-top:16px; overflow-wrap:anywhere; }
.reporting-chat-answer caption { text-align:left; padding:8px; font-weight:600; }
.reporting-bars { display:grid; gap:10px; margin-top:16px; }
.reporting-bar-row { display:grid; grid-template-columns:minmax(100px,1fr) minmax(60px,2fr) 50px; gap:10px; align-items:center; font-size:13px; }
.reporting-bar-track { background:#e2e8f0; height:14px; border-radius:4px; overflow:hidden; }
.reporting-bar { height:100%; background:#4f46e5; }
.chat-message-text { white-space:pre-wrap; line-height:1.6; }

/* Compact search with expandable advanced filters. */
.municipality-toolbar .municipality-filters { display: block; flex: 1 1 560px; min-width: 0; }
.municipality-search-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.municipality-search-row #mun-search { flex: 1 1 240px; width: auto; min-width: 0; }
.municipality-search-row .btn { white-space: nowrap; }
.municipality-advanced { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.municipality-advanced[hidden] { display: none; }
.municipality-advanced input, .municipality-advanced select { width: 100%; min-width: 0; }
@media (max-width: 900px) {
  .municipality-advanced { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .municipality-search-row #mun-search { flex-basis: 100%; width: 100%; }
  .municipality-advanced { grid-template-columns: 1fr; }
}/* Acesso: controles claros no computador e no celular. */
.auth-password { display:flex;align-items:center;border:1px solid var(--border-color);border-radius:var(--radius-md);background:var(--bg-surface); }
.auth-password:focus-within { outline:2px solid var(--primary);outline-offset:2px; }
.auth-password input { min-width:0;flex:1;border:0;box-shadow:none; }
.auth-password input:focus { outline:0;box-shadow:none; }
.password-toggle { flex-shrink:0;min-height:44px;padding:0 12px;color:var(--text-secondary);background:transparent;border:0;font-size:12px;font-weight:600;cursor:pointer; }
.auth-code-link { display:block;margin:18px 0;text-align:left;min-height:32px; }
#reset-fields { border:0;padding:0;margin:20px 0 0;min-width:0; }
.auth-step-label { padding-top:18px;border-top:1px solid var(--border-color);font-weight:600;margin-bottom:16px; }
.auth-form .alert { margin:14px 0;overflow-wrap:anywhere; }
.auth-links { gap:16px;flex-wrap:wrap; }
.auth-form button:focus-visible { outline:2px solid var(--primary);outline-offset:3px; }
@media(max-width:600px) { .auth-card-container { padding:28px 22px;align-items:flex-start; } .auth-form input { font-size:16px; } .auth-card { max-width:420px; } }

/* ============================================================================
 * PAINEL BI EXECUTIVO (Relatórios & BI)
 * ============================================================================ */
.bi-top-bar { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:12px 14px; margin-bottom:12px; background:var(--bg-surface); border:1px solid var(--border-color); border-radius:12px; }
.bi-top-bar-left { display:flex; align-items:flex-end; gap:10px; flex-wrap:wrap; flex:1 1 auto; }
.bi-compact-filters { display:flex; align-items:flex-end; gap:8px; flex-wrap:wrap; }
.bi-filter-field { display:flex; flex-direction:column; gap:3px; min-width:128px; }
.bi-filter-field.bi-filter-uf { min-width:86px; }
.bi-filter-field label { margin:0; font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.03em; }
.bi-filter-field input, .bi-filter-field select { min-height:34px; padding:5px 8px; font-size:13px; width:100%; }
.bi-top-bar-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bi-tabs-bar { margin-bottom:14px; }
.bi-exec-root { display:flex; flex-direction:column; gap:18px; }

/* Banner Executivo no topo do BI */
.bi-hero-banner {
  padding:20px 22px;
  border-radius:16px;
  background:linear-gradient(135deg, #0f172a 0%, #1e3a8a 58%, #1d4ed8 100%);
  color:#f8fafc;
  box-shadow:0 12px 28px rgba(15, 23, 42, 0.14);
  display:flex;
  flex-direction:column;
  gap:16px;
}
.bi-hero-top { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.bi-hero-eyebrow {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  background:rgba(255, 255, 255, 0.14);
  color:#dbeafe;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.04em;
  text-transform:uppercase;
}
.bi-hero-title { margin:8px 0 4px; font-size:20px; font-weight:800; letter-spacing:-0.02em; color:#ffffff; }
.bi-hero-desc { margin:0; font-size:13px; color:#cbd5e1; max-width:680px; line-height:1.45; }
.bi-hero-badges { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bi-hero-pill {
  padding:6px 12px;
  border-radius:10px;
  background:rgba(255, 255, 255, 0.12);
  border:1px solid rgba(255, 255, 255, 0.16);
  font-size:12px;
  color:#e2e8f0;
}
.bi-hero-pill strong { color:#ffffff; font-weight:800; margin-left:4px; }
.bi-insights-row { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:10px; }
.bi-insight-chip {
  padding:11px 14px;
  border-radius:12px;
  background:rgba(255, 255, 255, 0.1);
  border:1px solid rgba(255, 255, 255, 0.16);
  border-left:4px solid #60a5fa;
  backdrop-filter:blur(6px);
}
.bi-insight-chip.is-good { border-left-color:#4ade80; background:rgba(22, 163, 74, 0.18); }
.bi-insight-chip.is-warn { border-left-color:#fbbf24; background:rgba(217, 119, 6, 0.22); }
.bi-insight-chip.is-info { border-left-color:#60a5fa; }
.bi-insight-chip.is-neutral { border-left-color:#cbd5e1; }
.bi-insight-title { font-size:12.5px; font-weight:700; color:#ffffff; margin-bottom:2px; }
.bi-insight-detail { font-size:11.5px; color:#e2e8f0; line-height:1.4; }

/* Linha 1: 4 KPIs Executivos */
.bi-kpi-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:14px; }
.bi-kpi-card {
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  text-align:left;
  padding:18px;
  border-radius:14px;
  background:var(--bg-surface);
  border:1px solid var(--border-color);
  border-top:4px solid var(--primary);
  box-shadow:0 2px 10px rgba(15, 23, 42, 0.04);
  font-family:inherit;
  transition:transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.bi-kpi-card:hover { box-shadow:0 8px 20px rgba(15, 23, 42, 0.07); }
.bi-kpi-card.is-good { border-top-color:#16a34a; background:linear-gradient(180deg, #f0fdf4 0%, var(--bg-surface) 38%); }
.bi-kpi-card.is-warn { border-top-color:#d97706; background:linear-gradient(180deg, #fffbeb 0%, var(--bg-surface) 52%); }
.bi-kpi-card.is-neutral { border-top-color:#64748b; }
.bi-kpi-card.is-primary { border-top-color:var(--primary); background:linear-gradient(180deg, #eff6ff 0%, var(--bg-surface) 38%); }
.bi-kpi-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.bi-kpi-label { font-size:12px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.03em; }
.bi-kpi-icon {
  width:34px;
  height:34px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.bi-kpi-icon.is-good { background:#dcfce7; color:#15803d; }
.bi-kpi-icon.is-primary { background:#dbeafe; color:#1d4ed8; }
.bi-kpi-icon.is-indigo { background:#e0e7ff; color:#4338ca; }
.bi-kpi-icon.is-warn { background:#fef3c7; color:#b45309; }
.bi-kpi-value { font-size:26px; font-weight:800; color:var(--text-main); line-height:1.15; margin:10px 0 6px; letter-spacing:-0.025em; }
.bi-kpi-sub { font-size:12px; font-weight:600; color:var(--text-secondary); line-height:1.4; }
.bi-kpi-hint { margin-top:8px; padding-top:8px; border-top:1px dashed var(--border-color); font-size:11.5px; color:var(--text-muted); line-height:1.35; }
.bi-kpi-action { cursor:pointer; }
.bi-kpi-action:hover, .bi-kpi-action:focus-visible { transform:translateY(-2px); box-shadow:0 10px 24px rgba(180, 83, 9, 0.14); outline:2px solid #d97706; outline-offset:2px; }
.bi-kpi-cta { margin-top:10px; padding-top:8px; border-top:1px dashed rgba(217, 119, 6, 0.35); font-size:12px; font-weight:700; color:#b45309; }
.bi-kpi-card.is-good .bi-kpi-cta { color:#15803d; border-top-color:rgba(22, 163, 74, 0.25); }

/* Grade de 2 colunas no desktop */
.bi-charts-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:16px; align-items:stretch; }
.bi-chart-card {
  display:flex;
  flex-direction:column;
  padding:20px 22px;
  border-radius:14px;
  background:var(--bg-surface);
  border:1px solid var(--border-color);
  box-shadow:0 2px 12px rgba(15, 23, 42, 0.04);
}
.bi-chart-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.bi-chart-head h3 { margin:0; font-size:16px; font-weight:800; color:var(--text-main); letter-spacing:-0.01em; }
.bi-chart-sub { margin:4px 0 0; font-size:12.5px; color:var(--text-muted); line-height:1.45; }
.bi-chart-body { flex:1 1 auto; display:flex; flex-direction:column; justify-content:flex-start; min-height:185px; }
.bi-chart-foot { margin-top:12px; padding-top:9px; border-top:1px solid var(--border-color); font-size:11.5px; color:var(--text-muted); }
.bi-empty-box { padding:28px 18px; text-align:center; font-size:13px; color:var(--text-muted); background:var(--bg-subtle); border:1px dashed var(--border-color); border-radius:12px; }

/* Legendas */
.bi-legend { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:12px; color:var(--text-secondary); }
.bi-legend-item { display:inline-flex; align-items:center; gap:6px; font-weight:600; padding:4px 9px; border-radius:999px; background:var(--bg-subtle); border:1px solid var(--border-color); font-size:11.5px; }
.bi-dot { display:inline-block; width:9px; height:9px; border-radius:999px; }
.bi-dot.is-primary { background:var(--primary); }
.bi-dot.is-good { background:#16a34a; }
.bi-dot.is-warn { background:#d97706; }

/* Barras horizontais (Conversão do funil & Motivos de perda) */
.bi-hbar-list { display:flex; flex-direction:column; gap:10px; }
.bi-hbar-item { display:flex; flex-direction:column; gap:6px; padding:8px 10px; border-radius:10px; border:1px solid transparent; background:transparent; text-align:left; width:100%; font-family:inherit; transition:background 0.14s ease, border-color 0.14s ease; }
.bi-hbar-item:focus-visible, .bi-hbar-item:hover { background:var(--bg-subtle); border-color:var(--border-color); outline:none; }
.bi-hbar-clickable { cursor:pointer; }
.bi-hbar-clickable:hover, .bi-hbar-clickable:focus-visible { border-color:#f59e0b; background:#fffbeb; }
.bi-hbar-head { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:13px; }
.bi-hbar-label { display:inline-flex; align-items:center; gap:7px; font-weight:600; color:var(--text-main); }
.bi-step-index, .bi-rank-badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:24px;
  height:20px;
  padding:0 6px;
  border-radius:6px;
  font-size:11px;
  font-weight:700;
  background:#eff6ff;
  color:#1d4ed8;
}
.bi-rank-badge { background:#fef3c7; color:#b45309; }
.bi-hbar-metrics { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--text-secondary); flex-wrap:wrap; }
.bi-hbar-track { height:12px; width:100%; border-radius:999px; background:#e2e8f0; overflow:hidden; }
.bi-hbar-fill { height:100%; border-radius:999px; transition:width 0.35s ease; }
.bi-hbar-fill.is-primary { background:linear-gradient(90deg, #2563eb 0%, #4f46e5 100%); }
.bi-hbar-fill.is-good { background:linear-gradient(90deg, #16a34a 0%, #22c55e 100%); }
.bi-hbar-fill.is-warn { background:linear-gradient(90deg, #f59e0b 0%, #ea580c 100%); }
.bi-conv-pill { display:inline-block; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:700; }
.bi-conv-pill.is-good { background:#dcfce7; color:#15803d; }
.bi-conv-pill.is-neutral { background:#dbeafe; color:#1d4ed8; }
.bi-conv-pill.is-warn { background:#fef3c7; color:#b45309; }
.bi-conv-pill.is-final, .bi-conv-pill.is-empty { background:#f1f5f9; color:#475569; }

/* Colunas agrupadas (Previsão de fechamento & Eficiência da prospecção) */
.bi-col-chart {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(72px, 1fr));
  gap:10px;
  align-items:end;
  height:208px;
  padding:24px 10px 8px;
  background:repeating-linear-gradient(to top, rgba(148, 163, 184, 0.14) 0, rgba(148, 163, 184, 0.14) 1px, transparent 1px, transparent 42px), var(--bg-subtle);
  border-radius:12px;
  border:1px solid var(--border-color);
}
.bi-col-group { display:flex; flex-direction:column; align-items:center; height:100%; justify-content:flex-end; border-radius:8px; padding:4px; transition:background 0.14s ease; }
.bi-col-group:hover, .bi-col-group:focus-visible { background:rgba(37, 99, 235, 0.08); outline:2px solid var(--primary); outline-offset:1px; }
.bi-col-bars { display:flex; align-items:flex-end; justify-content:center; gap:6px; width:100%; flex:1 1 auto; min-height:115px; }
.bi-col-slot { display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; flex:1 1 0; max-width:30px; }
.bi-col-val { font-size:10px; font-weight:700; margin-bottom:4px; white-space:nowrap; }
.bi-col-val.is-primary { color:#1d4ed8; }
.bi-col-val.is-good { color:#15803d; }
.bi-col-val.is-warn { color:#b45309; }
.bi-col-bar { width:100%; border-radius:6px 6px 2px 2px; min-height:3px; transition:height 0.3s ease; }
.bi-col-bar.is-primary { background:linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%); }
.bi-col-bar.is-good { background:linear-gradient(180deg, #22c55e 0%, #15803d 100%); }
.bi-col-bar.is-warn { background:linear-gradient(180deg, #fbbf24 0%, #d97706 100%); }
.bi-col-label { font-size:11px; font-weight:700; color:var(--text-secondary); margin-top:8px; white-space:nowrap; }

/* Faixas de qualidade, prospecção e receptividade */
.bi-quality-strip, .bi-sentiment-strip { margin-top:12px; padding:10px 12px; border-radius:10px; font-size:12px; background:var(--bg-subtle); border:1px solid var(--border-color); display:flex; flex-direction:column; gap:8px; }
.bi-quality-strip.is-warn { background:#fffbeb; border-color:#fcd34d; color:#92400e; }
.bi-quality-strip.is-good { background:#f0fdf4; border-color:#bbf7d0; color:#166534; }
.bi-prosp-summary { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; margin-bottom:14px; }
.bi-prosp-pill {
  padding:10px 14px;
  border-radius:10px;
  background:var(--bg-subtle);
  border:1px solid var(--border-color);
  display:flex;
  flex-direction:column;
  gap:2px;
}
.bi-prosp-pill span { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.03em; }
.bi-prosp-pill strong { font-size:19px; font-weight:800; color:var(--text-main); }
.bi-prosp-pill strong em { font-style:normal; font-size:12.5px; font-weight:700; color:#15803d; }
.bi-prosp-pill.is-good { background:#f0fdf4; border-color:#bbf7d0; }
.bi-prosp-pill.is-warn { background:#fffbeb; border-color:#fde68a; }
.bi-sentiment-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bi-sentiment-bar { display:flex; height:8px; width:100%; border-radius:999px; overflow:hidden; background:#e2e8f0; }
.bi-sentiment-bar .is-good { background:#16a34a; }
.bi-sentiment-bar .is-neutral { background:#94a3b8; }
.bi-sentiment-bar .is-warn { background:#f59e0b; }

/* Meta x Realizado com anel SVG */
.bi-goal-tabs { display:inline-flex; gap:4px; background:var(--bg-subtle); padding:4px; border-radius:10px; border:1px solid var(--border-color); margin-bottom:16px; flex-wrap:wrap; }
.bi-goal-tab { border:0; background:transparent; padding:6px 12px; border-radius:7px; font-size:12px; font-weight:600; color:var(--text-muted); cursor:pointer; font-family:inherit; transition:background 0.14s ease, color 0.14s ease; }
.bi-goal-tab.active { background:var(--bg-surface); color:var(--primary); box-shadow:0 1px 4px rgba(15, 23, 42, 0.08); }
.bi-goal-body { display:flex; flex-direction:column; gap:14px; flex:1 1 auto; justify-content:center; }
.bi-goal-showcase { display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
.bi-goal-ring-wrap { position:relative; width:104px; height:104px; flex:0 0 104px; }
.bi-goal-ring { width:100%; height:100%; transform:rotate(-90deg); }
.bi-goal-ring-bg { fill:none; stroke:#e2e8f0; stroke-width:10; }
.bi-goal-ring-fg { fill:none; stroke-width:10; stroke-linecap:round; transition:stroke-dashoffset 0.4s ease; }
.bi-goal-ring-fg.is-primary { stroke:#2563eb; }
.bi-goal-ring-fg.is-good { stroke:#16a34a; }
.bi-goal-ring-fg.is-warn { stroke:#d97706; }
.bi-goal-ring-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.bi-goal-ring-center strong { font-size:18px; font-weight:800; color:var(--text-main); line-height:1.1; }
.bi-goal-ring-center span { font-size:10px; color:var(--text-muted); font-weight:600; text-transform:uppercase; }
.bi-goal-numbers { flex:1 1 200px; display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; }
.bi-goal-stat { padding:10px 12px; border-radius:10px; background:var(--bg-subtle); border:1px solid var(--border-color); }
.bi-goal-kicker { display:block; font-size:10.5px; color:var(--text-muted); text-transform:uppercase; font-weight:700; margin-bottom:3px; }
.bi-goal-big { font-size:17px; color:var(--text-main); }
.bi-progress-track { height:12px; width:100%; border-radius:999px; background:#e2e8f0; overflow:hidden; }
.bi-progress-fill { height:100%; border-radius:999px; transition:width 0.35s ease; }
.bi-progress-fill.is-primary { background:linear-gradient(90deg, #2563eb 0%, #4f46e5 100%); }
.bi-progress-fill.is-good { background:linear-gradient(90deg, #16a34a 0%, #22c55e 100%); }
.bi-progress-fill.is-warn { background:linear-gradient(90deg, #f59e0b 0%, #d97706 100%); }
.bi-progress-caption { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:12px; color:var(--text-muted); }

@media (max-width: 1120px) {
  .bi-kpi-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .bi-charts-grid { grid-template-columns:1fr; }
  .bi-prosp-summary { grid-template-columns:1fr; }
}
@media (max-width: 600px) {
  .bi-kpi-grid { grid-template-columns:1fr; }
  .bi-goal-numbers { grid-template-columns:1fr; }
  .bi-filter-field { flex:1 1 130px; }
}

/* ============================================================================
 * CONFIGURAÇÕES — APIS E INTELIGÊNCIA ARTIFICIAL
 * ============================================================================ */
.ai-settings-stack { display:flex; flex-direction:column; gap:14px; }
.ai-summary-strip { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; }
.ai-stat-card { padding:12px 14px; background:var(--bg-surface); border:1px solid var(--border-color); border-radius:var(--radius-lg); box-shadow:var(--shadow-xs); display:flex; flex-direction:column; gap:4px; }
.ai-stat-label { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); }
.ai-stat-value { font-size:13.5px; font-weight:700; color:var(--text-primary); }
.ai-stat-value.is-ok { color:#15803d; }

.ai-card { padding:18px 20px; }
.ai-card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.ai-card-heading { min-width:0; flex:1 1 280px; }
.ai-title-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ai-card-title { margin:0; font-size:15.5px; font-weight:700; color:var(--text-primary); }
.ai-card-subtitle { margin:4px 0 0; font-size:12.5px; line-height:1.45; color:var(--text-muted); }
.ai-status-line { margin:10px 0 0; font-size:12.5px; color:var(--text-secondary); }

.ai-switch { display:inline-flex; align-items:center; gap:9px; cursor:pointer; user-select:none; padding:5px 10px 5px 6px; border:1px solid var(--border-color); border-radius:999px; background:var(--bg-subtle); flex:0 0 auto; }
.ai-switch input { position:absolute; opacity:0; width:1px; height:1px; pointer-events:none; }
.ai-switch-track { position:relative; width:36px; height:20px; border-radius:999px; background:#cbd5e1; transition:background 0.16s ease; flex:0 0 auto; }
.ai-switch-thumb { position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:999px; background:#ffffff; box-shadow:0 1px 2px rgba(15, 23, 42, 0.2); transition:transform 0.16s ease; }
.ai-switch input:checked + .ai-switch-track { background:var(--primary); }
.ai-switch input:checked + .ai-switch-track .ai-switch-thumb { transform:translateX(16px); }
.ai-switch input:focus-visible + .ai-switch-track { outline:2px solid var(--primary); outline-offset:2px; }
.ai-switch-text { font-size:12px; font-weight:600; color:var(--text-secondary); }

.ai-provider-shortcuts { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; margin-top:14px; }
.ai-provider-chip { display:flex; flex-direction:column; justify-content:space-between; gap:10px; padding:12px 14px; border:1px solid var(--border-color); border-radius:var(--radius-md); background:var(--bg-subtle); transition:border-color 0.14s ease, background 0.14s ease; }
.ai-provider-chip:hover { border-color:var(--primary-border); background:var(--bg-surface); }
.ai-provider-chip-info { display:flex; flex-direction:column; gap:2px; }
.ai-provider-chip-info strong { font-size:13.5px; color:var(--text-primary); }
.ai-provider-chip-info span { font-size:11.5px; color:var(--text-muted); line-height:1.35; }
.ai-provider-chip-actions { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.ai-ext-link { font-size:12px; font-weight:600; color:var(--primary); text-decoration:none; }
.ai-ext-link:hover { text-decoration:underline; }

.ai-priority-pill { display:inline-flex; align-items:center; justify-content:center; min-width:34px; padding:3px 8px; border-radius:999px; background:var(--bg-subtle); border:1px solid var(--border-color); font-size:12px; font-weight:700; color:var(--text-primary); }
.ai-key-name { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ai-key-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:3px; font-size:11.5px; color:var(--text-muted); }

.ai-form-panel { margin-top:16px; padding:16px 18px; border:1px solid var(--primary-border); border-radius:var(--radius-lg); background:var(--bg-subtle); }
.ai-form-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }
.ai-form-title { margin:0; font-size:14.5px; font-weight:700; color:var(--text-primary); }
.ai-label-row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.ai-key-input-wrap { display:flex; align-items:center; gap:8px; }
.ai-key-input-wrap input { flex:1 1 auto; }
.ai-confirm-box { display:flex; align-items:flex-start; gap:9px; padding:10px 12px; margin:10px 0 14px; border:1px solid var(--border-color); border-radius:var(--radius-md); background:var(--bg-surface); font-size:12.5px; line-height:1.4; color:var(--text-secondary); cursor:pointer; }
.ai-confirm-box input[type="checkbox"] { width:auto; margin-top:2px; flex:0 0 auto; }
.ai-form-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding-top:8px; border-top:1px solid var(--border-color); }

.ai-details { margin-top:12px; border:1px solid var(--border-color); border-radius:var(--radius-md); background:var(--bg-subtle); padding:8px 12px; }
.ai-details summary { cursor:pointer; font-size:12.5px; font-weight:600; color:var(--text-secondary); list-style:none; display:flex; align-items:center; gap:6px; }
.ai-details summary::-webkit-details-marker { display:none; }
.ai-details summary::before { content:'▸'; font-size:11px; color:var(--text-muted); transition:transform 0.14s ease; }
.ai-details[open] summary::before { transform:rotate(90deg); }
.ai-details-body { margin-top:8px; font-size:12.5px; line-height:1.5; color:var(--text-secondary); display:flex; flex-direction:column; gap:6px; }
.ai-details-body p { margin:0; }

@media (max-width: 960px) {
  .ai-summary-strip, .ai-provider-shortcuts { grid-template-columns:1fr; }
}

/* ============================================================================
 * KANBAN — ENCOLHER / DESENCOLHER COLUNAS E MODO COMPACTO
 * ============================================================================ */
.kb-view-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kanban-board {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: auto;
}

.kanban-column {
  flex: 1 0 260px;
  min-width: 260px;
  max-width: none;
  transition: flex-basis 0.16s ease, width 0.16s ease, min-width 0.16s ease;
}

.kb-col-header-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.kb-col-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.kb-col-collapse-btn:hover {
  background: var(--bg-muted, #f1f5f9);
  border-color: var(--border-color);
  color: var(--text-main);
}

.kb-col-collapsed-rail {
  display: none;
}

.kanban-column.is-collapsed {
  flex: 0 0 52px;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  min-height: 240px;
  cursor: pointer;
  background: var(--bg-surface);
}

.kanban-column.is-collapsed:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.kanban-column.is-collapsed .kanban-col-header,
.kanban-column.is-collapsed .kanban-cards {
  display: none;
}

.kanban-column.is-collapsed .kb-col-collapsed-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 14px;
  width: 100%;
  min-height: 240px;
  box-sizing: border-box;
  user-select: none;
}

.kb-col-expand-icon {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.kanban-column.is-collapsed:hover .kb-col-expand-icon {
  color: var(--primary);
}

.kb-col-rail-name {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.01em;
  max-height: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modo Kanban Encolhido (Compacto) */
.kanban-board.is-compact {
  gap: 8px;
}

.kanban-board.is-compact .kanban-column:not(.is-collapsed) {
  flex: 1 0 196px;
  min-width: 196px;
}

.kanban-board.is-compact .kanban-col-header {
  padding: 7px 8px 6px;
}

.kanban-board.is-compact .kb-col-name {
  font-size: 12.5px;
}

.kanban-board.is-compact .kb-col-meta-line,
.kanban-board.is-compact .kb-col-progress-track {
  display: none;
}

.kanban-board.is-compact .kanban-col-totals {
  margin-top: 4px;
  font-size: 11px;
}

.kanban-board.is-compact .kanban-cards {
  padding: 6px;
  gap: 6px;
}

.kanban-board.is-compact .kanban-card {
  padding: 8px;
  gap: 5px;
}

.kanban-board.is-compact .kb-empty-column {
  padding: 14px 8px;
  font-size: 11.5px;
}

@media (max-width: 768px) {
  .kanban-board .kanban-column:not(.is-collapsed) {
    flex: 0 0 82vw;
    min-width: 260px;
  }
  .kanban-board.is-compact .kanban-column:not(.is-collapsed) {
    flex: 0 0 64vw;
    min-width: 200px;
  }
}

/* Respostas de regras das etapas no Card do Kanban e no Painel da Oportunidade */
.kb-stage-answer {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--primary);
}

.kb-stage-answer-body {
  min-width: 0;
  flex: 1;
}

.kb-stage-answer-text {
  margin: 2px 0 3px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-main);
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-stage-answer small {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

.opp-stage-answers-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opp-stage-answers-card {
  border-left: 4px solid var(--primary);
  background: var(--bg-surface);
  margin-bottom: 0;
}

.opp-stage-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.opp-stage-answers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opp-stage-answer-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

.opp-stage-answer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.opp-stage-answer-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.opp-stage-answer-value {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.opp-stage-answer-empty {
  font-style: italic;
}

.opp-stage-answer-inline {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.opp-stage-history-details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--bg-surface);
}

.opp-stage-history-details > summary {
  cursor: pointer;
  color: var(--text-muted);
}

/* Campo pesquisável (autocomplete) para seleção de empresas e prefeituras */
.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select.is-compact {
  min-width: 210px;
  max-width: 260px;
  width: auto;
}

.searchable-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.searchable-select-control {
  position: relative;
  display: flex;
  align-items: center;
}

.searchable-select-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.searchable-select-input {
  width: 100%;
  padding-left: 32px !important;
  padding-right: 52px !important;
  text-overflow: ellipsis;
}

.searchable-select.is-compact .searchable-select-input {
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 13px;
}

.searchable-select-clear {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.searchable-select-clear:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.searchable-select-clear[hidden] {
  display: none;
}

.searchable-select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.searchable-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 600;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  padding: 4px;
}

.searchable-select-menu[hidden] {
  display: none;
}

.searchable-select-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

.searchable-select-option.is-selected {
  font-weight: 600;
}

.searchable-select-option.is-pinned {
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
  padding-top: 9px;
  border-radius: 0 0 6px 6px;
  color: var(--primary);
  font-weight: 600;
}

.searchable-select-empty,
.searchable-select-more {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.searchable-select-more {
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}

/* Seleção em lote na listagem de Prefeituras / Empresas */
.entities-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}

.entities-bulk-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #1e3a8a;
}

.entities-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.col-ent-select {
  width: 38px;
  min-width: 38px;
  text-align: center;
}

.col-ent-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.entities-table tbody tr.is-selected-row {
  background: #eff6ff;
}
