:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #0a1f14;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-on-dark: #f1f5f9;
  --border: #e2e8f0;
  --primary: #006B3F;
  --primary-hover: #005a34;
  --primary-light: #ecfdf5;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
.admin-only { display: none !important; }
body.perfil-admin .admin-only { display: revert !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--bg-header);
  color: var(--text-on-dark);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.perfil-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.perfil-badge-admin { background: #006B3F; color: #fff; }
.perfil-badge-consulta { background: #0ea5e9; color: #fff; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #94a3b8;
}

.btn-logout {
  background: none;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: #334155;
  color: #fff;
}
.btn-alterar-senha {
  background: none;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  line-height: 1;
}
.btn-alterar-senha:hover {
  background: #334155;
  color: #fff;
}

/* Password toggle */
.input-senha-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-senha-wrapper input {
  flex: 1;
  padding-right: 42px;
}
.btn-toggle-senha {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.btn-toggle-senha:hover {
  color: var(--text);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 420px;
  margin: 20px;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-card form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.modal-card select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}

/* Layout */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

#view-simulador .container {
  max-width: 1100px;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Login */
.login-screen {
  min-height: 100vh;
  background: #0a1f14;
  position: relative;
  overflow: hidden;
}
.login-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #006B3F, #2d7a52, #4ade80, #2d7a52, #006B3F);
  z-index: 2;
}
.login-grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23fff' stroke-width='0.5'/%3E%3C/svg%3E");
}
.login-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.login-hero {
  display: flex;
  align-items: center;
  padding: 48px;
}
.login-hero-content {
  max-width: 440px;
}
.login-hero-title {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.login-hero-accent {
  color: #4ade80;
}
.login-hero-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.45);
  line-height: 1.7;
  margin-bottom: 24px;
}
.login-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.login-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.03);
}
.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.login-card-sub {
  font-size: 14px;
  color: #888;
  margin-bottom: 24px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
}

.btn-secondary:hover { background: #f1f5f9; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

/* Convenios grid */
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.convenios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.convenio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}

.convenio-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg);
  transform: translateY(-1px);
}

.convenio-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.convenio-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.convenio-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-uf {
  background: var(--primary-light);
  color: var(--primary);
}

/* Publicacoes */
.pub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.pub-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.btn-back:hover { color: var(--text); }

.btn-atualizar {
  background: var(--primary);
  color: #fff;
}

.btn-atualizar:hover { background: var(--primary-hover); }
.btn-atualizar:disabled { opacity: 0.6; cursor: not-allowed; }

.pub-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pub-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f8fafc;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

tbody tr:hover { background: #f8fafc; }

.pub-titulo {
  font-weight: 500;
  max-width: 360px;
}

.pub-texto {
  color: var(--text-secondary);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pub-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
}

.pub-link:hover { text-decoration: underline; }

/* Relevance highlight */
tr.relevante {
  background: #f0fdf4;
}

tr.relevante:hover {
  background: #dcfce7;
}

.badge-relevante {
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 6px;
  white-space: nowrap;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-filter {
  padding: 6px 14px;
  border: 1px solid #16a34a;
  border-radius: var(--radius);
  background: #f0fdf4;
  color: #16a34a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-filter:hover {
  background: #16a34a;
  color: #fff;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 13px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: var(--primary);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  color: var(--text-secondary);
  min-width: 100px;
  text-align: center;
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
}

/* Menu grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.menu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
  text-align: center;
}

.menu-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg);
  transform: translateY(-1px);
}

.menu-card-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.menu-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.menu-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.menu-card.card-credbr {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.menu-card.card-credbr:hover {
  border-color: #16a34a;
  box-shadow: 0 0 0 1px #16a34a, var(--shadow-lg);
}

.menu-card.menu-card-disabled {
  opacity: 0.55;
  cursor: default;
  background: #f8fafc;
}

.menu-card.menu-card-disabled:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: none;
}

.badge-em-breve {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border-radius: 10px;
  vertical-align: middle;
}

/* Simulador */
.simulador-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.simulador-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.simulador-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.sim-info-card {
  background: #f8fafc;
}

.simulador-tipo {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.simulador-card .form-group input {
  font-size: 20px;
  padding: 14px 16px;
  font-weight: 600;
}

.simulador-resultado {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.sim-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.sim-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.sim-hint {
  width: 100%;
  font-size: 11px;
  color: #b91c1c;
  margin-top: 2px;
}

.sim-row-alerta {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.sim-row-alerta .sim-label {
  color: var(--danger);
  font-weight: 600;
}

.sim-row-alerta .sim-value {
  color: var(--danger);
  font-size: 18px;
}

.simulador-validacao {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.sim-parecer {
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.sim-parecer-ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.sim-parecer-ok .sim-parecer-titulo {
  color: #16a34a;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

.sim-parecer-recusado {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.sim-parecer-recusado .sim-parecer-titulo {
  color: var(--danger);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

.sim-parecer-detalhe {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text-secondary);
}

.sim-parecer-detalhe span:last-child {
  font-weight: 600;
  color: var(--text);
}

/* Contrato info */
.contrato-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contrato-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.contrato-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.contrato-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.contrato-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.contrato-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.contrato-section-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.contrato-insights {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.contrato-insights .contrato-section-title {
  color: #16a34a;
}

.contrato-insights ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contrato-insights li {
  font-size: 13px;
  color: var(--text);
  padding-left: 16px;
  position: relative;
  line-height: 1.4;
}

.contrato-insights li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

/* Servidores */
.serv-busca {
  margin-bottom: 16px;
}

.serv-busca input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.serv-busca input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.serv-nome {
  font-weight: 500;
}

/* Simulador Comercial */
.sim-comercial-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

#view-simulador-comercial .container {
  max-width: 1100px;
}

.simulador-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.simulador-card select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.simc-resultado {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.simc-resultado-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

.simc-resultado-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.simc-resultado-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.simc-destaque {
  background: var(--primary-light);
  border-color: var(--primary);
}

.simc-resultado-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.simc-destaque .simc-resultado-label {
  color: var(--primary);
  font-weight: 600;
}

.simc-resultado-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.simc-destaque .simc-resultado-value {
  color: var(--primary);
  font-size: 18px;
}

.simc-formula {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
  background: #f8fafc;
  border-radius: var(--radius);
}

.simc-outro-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.simc-outro-row:last-child {
  border-bottom: none;
}

.simc-outro-prazo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 100px;
}

.simc-outro-valores {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.simc-outro-valores > span:first-child {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.simc-outro-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Micro Regras */
.micro-regras-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.micro-regra-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.micro-regra-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Mapa de Oportunidades */
#view-mapa .mapa-container,
#view-calendario .mapa-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 56px);
}

.mapa-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mapa-sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 12px;
}

.mapa-sidebar-title {
  font-size: 16px;
  font-weight: 700;
}

.mapa-search {
  padding: 0 16px 12px;
}

.mapa-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.mapa-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.mapa-lista {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.mapa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.mapa-item:hover {
  background: #f1f5f9;
}

.mapa-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.mapa-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mapa-item-info {
  flex: 1;
  min-width: 0;
}

.mapa-item-nome {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapa-item-uf {
  font-size: 11px;
  color: var(--text-secondary);
}

.mapa-item-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.mapa-totais {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  background: #f8fafc;
}

.mapa-totais strong {
  color: var(--text);
}

.mapa-main {
  background: var(--bg);
  overflow-y: auto;
  padding: 24px;
}

.mapa-painel {
  max-width: 900px;
  margin: 0 auto;
}

.mapa-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--text-secondary);
}

.mapa-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.mapa-empty-state p {
  font-size: 15px;
}

.mapa-header-municipio {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e8edf5;
}

.mapa-header-municipio h2 {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mapa-header-municipio .badge {
  font-size: 13px;
  padding: 5px 14px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.mapa-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.mapa-svg-wrapper {
  background: linear-gradient(145deg, #f8faff, #eef2fa);
  border: 1px solid #d4dbe8;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(37,99,235,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.mapa-svg-wrapper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd);
  border-radius: 12px 12px 0 0;
}

.mapa-svg-wrapper svg {
  width: 100%;
  max-height: 380px;
}

.mapa-kpis {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mapa-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border-left: 4px solid var(--primary);
  transition: transform 0.2s, box-shadow 0.2s;
}

.mapa-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.mapa-kpi-card.kpi-efetivos {
  border-left-color: #2563eb;
}

.mapa-kpi-card.kpi-comissionados {
  border-left-color: #d97706;
}

.mapa-kpi-card.kpi-contratados {
  border-left-color: #7c3aed;
}

.mapa-kpi-card.kpi-outros {
  border-left-color: #64748b;
}

.mapa-kpi-card.kpi-total {
  border-left-color: #16a34a;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.mapa-kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.mapa-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.mapa-kpi-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.mapa-fonte {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
}

.mapa-fonte a {
  color: var(--primary);
  text-decoration: none;
}

.mapa-fonte a:hover {
  text-decoration: underline;
}

.mapa-bar-section {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.mapa-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mapa-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.mapa-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 100px;
  text-align: right;
}

.mapa-bar-track {
  flex: 1;
  height: 28px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.mapa-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  padding-left: 10px;
}

.mapa-bar-fill span {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.mapa-bar-fill.bar-efetivos { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.mapa-bar-fill.bar-comissionados { background: linear-gradient(90deg, #d97706, #f59e0b); }
.mapa-bar-fill.bar-contratados { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }
.mapa-bar-fill.bar-outros { background: linear-gradient(90deg, #64748b, #94a3b8); }

.serv-filtros {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 12px;
  flex-wrap: wrap;
}

.serv-filtro-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
}

.serv-filtro-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.serv-filtro-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.serv-filtro-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.serv-vinculo-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
}

.serv-vinculo-badge.vinculo-efetivo {
  background: #dbeafe;
  color: #1e40af;
}

.serv-vinculo-badge.vinculo-comissionado {
  background: #fef3c7;
  color: #92400e;
}

.serv-vinculo-badge.vinculo-contratado {
  background: #ede9fe;
  color: #5b21b6;
}

.serv-vinculo-badge.vinculo-outro {
  background: #f1f5f9;
  color: #475569;
}

/* Responsive */
@media (max-width: 860px) {
  .simulador-wrapper { grid-template-columns: 1fr; }
  .sim-comercial-wrapper { grid-template-columns: 1fr; }
  .neo-page { padding: 0 12px 32px; }
  #view-mapa .mapa-container,
  #view-calendario .mapa-container { grid-template-columns: 1fr; }
  .mapa-sidebar { max-height: 300px; border-right: none; border-bottom: 1px solid var(--border); }
  .mapa-content { grid-template-columns: 1fr; }
}

/* Dashboard */
.dash-header { margin-bottom: 24px; }
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.dash-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.dash-kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.dash-kpi-label {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}
.dash-kpi-detail {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}
.dash-kpi-alerta {
  border-color: #fecaca;
  background: #fef2f2;
}
.dash-kpi-alerta .dash-kpi-value { color: #dc2626; }
.dash-alerta-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.dash-alerta-icone { font-size: 18px; }
.dash-alerta-texto { flex: 1; }
.dash-alerta-dias { font-weight: 600; font-size: 13px; white-space: nowrap; }
.dash-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  margin-top: 8px;
}
.dash-modulos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.dash-modulo-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all .15s;
}
.dash-modulo-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37,99,235,.08);
  transform: translateY(-1px);
}
.dash-modulo-icon {
  font-size: 32px;
  flex-shrink: 0;
}
.dash-modulo-info { flex: 1; min-width: 0; }
.dash-modulo-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.dash-modulo-info p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}
.dash-modulo-meta {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #2563eb;
  font-weight: 600;
}
.dash-modulo-arrow {
  font-size: 20px;
  color: #cbd5e1;
  flex-shrink: 0;
}
.dash-modulo-card:hover .dash-modulo-arrow { color: #2563eb; }
.dash-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}
.dash-timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.dash-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-timeline-nome {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.dash-timeline-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.dash-timeline-data {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}
@media (max-width: 860px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-modulos { grid-template-columns: 1fr; }
}

/* Ranking de Atratividade */
.rank-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}
.rank-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all .15s;
}
.rank-card:hover { border-color: #93c5fd; }
.rank-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.rank-pos {
  font-size: 14px;
  font-weight: 800;
  color: #94a3b8;
  min-width: 28px;
}
.rank-card:nth-child(1) .rank-pos { color: #ca8a04; }
.rank-card:nth-child(2) .rank-pos { color: #64748b; }
.rank-card:nth-child(3) .rank-pos { color: #b45309; }
.rank-info { flex: 1; display: flex; align-items: center; gap: 8px; }
.rank-nome { font-weight: 600; font-size: 14px; color: var(--text); }
.rank-uf {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 4px;
}
.rank-score-wrap { display: flex; align-items: center; gap: 8px; }
.rank-score-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--cor) calc(var(--score) * 3.6deg), #e2e8f0 0);
  position: relative;
}
.rank-score-ring::before {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
}
.rank-score-num {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.rank-score-label { font-size: 11px; font-weight: 600; white-space: nowrap; }
.rank-detail {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  margin-top: -2px;
  padding-top: 12px;
}
.rank-expanded .rank-detail { display: block; }
.rank-dim {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.rank-dim-label {
  font-size: 12px;
  color: #64748b;
  min-width: 110px;
  white-space: nowrap;
}
.rank-dim-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.rank-dim-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}
.rank-dim-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 24px;
  text-align: right;
}
.rank-custo-info {
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 6px;
}

/* Calendário de Obrigações */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid #e2e8f0;
}
.cal-nav-btn {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #475569;
}
.cal-nav-btn:hover { background: #f1f5f9; }
.cal-mes-label {
  font-weight: 600;
  font-size: 15px;
  color: #1e293b;
}
.cal-filtros {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.cal-filtro-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
}
.cal-filtro-btn:hover { background: #e2e8f0; }
.cal-filtro-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.cal-dia-num {
  min-width: 44px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: #334155;
  line-height: 1;
}
.cal-dia-dow {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 2px;
}
.cal-dia-hoje {
  color: #2563eb;
}
.cal-past .mapa-item-nome,
.cal-past .mapa-item-uf,
.cal-past .cal-dia-num { opacity: .5; }
.cal-hoje { border-left: 3px solid #2563eb; }
.cal-obrigacoes-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.cal-obrigacao-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}
.cal-obrigacao-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 4px;
}
.cal-obrigacao-tipo {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.cal-obrigacao-convenio {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}
.cal-obrigacao-desc {
  font-size: 14px;
  color: #475569;
}
.cal-obrigacao-nota {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 4px;
}

/* Esteira de Renovação */
.esteira-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.esteira-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.esteira-card-nome {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.esteira-card-alerta {
  font-size: 13px;
  font-weight: 600;
}
.esteira-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.esteira-progress {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  position: relative;
}
.esteira-step {
  flex: 1;
  text-align: center;
  position: relative;
  padding-top: 28px;
}
.esteira-step::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 4px;
  background: #e2e8f0;
  z-index: 0;
}
.esteira-step:first-child::before { left: 50%; }
.esteira-step:last-child::before { right: 50%; }
.esteira-step.active::before {
  background: #059669;
}
.esteira-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
}
.esteira-step.active .esteira-step-dot {
  background: #d1fae5;
}
.esteira-step.current .esteira-step-dot {
  background: #059669;
  box-shadow: 0 0 0 4px rgba(5,150,105,0.2);
}
.esteira-step-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.esteira-step.active .esteira-step-label {
  color: #059669;
  font-weight: 600;
}
.esteira-step.current .esteira-step-label {
  color: #059669;
  font-weight: 700;
}
.esteira-proximo {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 16px;
}
.esteira-historico {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.esteira-hist-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.esteira-hist-item {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.esteira-hist-item:last-child { border-bottom: none; }
.esteira-hist-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.esteira-hist-tipo {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.esteira-hist-resp {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.esteira-hist-data {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: auto;
}
.esteira-hist-texto {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .login-split { grid-template-columns: 1fr; }
  .login-hero { padding: 48px 32px 0; }
  .login-hero-title { font-size: 28px; }
  .login-form-side { padding: 32px; }
}
@media (max-width: 640px) {
  .container { padding: 20px 16px; }
  .login-card { padding: 28px 24px; }
  .login-hero { padding: 32px 24px 0; }
  .login-hero-title { font-size: 24px; }
  .login-form-side { padding: 24px; }
  .convenios-grid { grid-template-columns: 1fr; }
  .pub-header { flex-direction: column; align-items: flex-start; }
  .header-title { font-size: 14px; }
  .micro-regras-grid { grid-template-columns: 1fr; }
}
