:root {
  --navy: #0B2340;
  --navy-2: #10305C;
  --gold: #C9A227;
  --gold-light: #E4C766;
  --teal: #146356;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --border: #E3E6EC;
  --text: #1B2430;
  --text-muted: #5B6472;
  --danger: #B3261E;
  --success: #1F7A4D;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11,35,64,.06), 0 4px 16px rgba(11,35,64,.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.serif {
  font-family: "Georgia", "Iowan Old Style", serif;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% 0%, rgba(201,162,39,.10), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, #081A31 65%, #05121F 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  padding: 36px 32px 30px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand .mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
}

.login-brand .name {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}
.login-brand .sub {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: .3px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--navy-2); }

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .2px;
  transition: background .15s;
}
.btn-primary:hover { background: var(--navy-2); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.login-error {
  background: #FCEBEA;
  color: var(--danger);
  border: 1px solid #F3C7C4;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.login-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ---------- App shell ---------- */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: stretch;
  padding: 0 20px;
  height: 58px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 22px;
  margin-right: 6px;
  border-right: 1px solid rgba(255,255,255,.14);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.topbar-brand .mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px;
}

.topnav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}

.topnav-item {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.72);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .2px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.topnav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.topnav-item.active {
  color: #fff;
  border-bottom-color: var(--gold);
  background: rgba(255,255,255,.05);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,.14);
  font-size: 13px;
  white-space: nowrap;
}
.topbar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11.5px;
}
.topbar-user button {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
}
.topbar-user button:hover { background: rgba(255,255,255,.1); }

.body-area { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 18px 12px;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  padding: 0 10px 10px;
}
.side-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.side-item:hover { background: var(--bg); }
.side-item.active { background: #EAF0FA; color: var(--navy-2); font-weight: 700; }

.content {
  flex: 1;
  padding: 26px 30px 60px;
  overflow-y: auto;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--navy);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---------- Cards / KPIs ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  font-family: "Georgia", serif;
}
.kpi-foot {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ---------- Tables ---------- */

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  padding: 9px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:hover td { background: #FAFBFD; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge-green { background: #E5F4EA; color: var(--success); }
.badge-gold { background: #FBF2DA; color: #8A6A0C; }
.badge-gray { background: #EEF0F3; color: var(--text-muted); }
.badge-red { background: #FCEBEA; color: var(--danger); }
.badge-navy { background: #E7EEF9; color: var(--navy-2); }

/* ---------- Associados grid (mapa) ---------- */

.assoc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.assoc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  box-shadow: var(--shadow);
  cursor: default;
}
.assoc-avatar {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--navy), var(--teal));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.assoc-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.assoc-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.5;
}

/* ---------- Empty / placeholder state ---------- */

.empty-state {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 46px 30px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #EEF0F3;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 20px;
}
.empty-state h3 {
  color: var(--text);
  font-size: 15px;
  margin: 0 0 8px;
}
.empty-state p {
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.55;
}
.empty-state .tag {
  display: inline-block;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 4px 11px;
  border-radius: 20px;
  background: #FBF2DA;
  color: #8A6A0C;
}

/* ---------- Funil (kanban simples) ---------- */

.funil-board {
  display: grid;
  gap: 12px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  overflow-x: auto;
  padding-bottom: 6px;
}
.funil-col {
  background: #F0F2F6;
  border-radius: var(--radius);
  padding: 10px;
  min-height: 160px;
}
.funil-col-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-muted);
  padding: 4px 6px 10px;
  display: flex;
  justify-content: space-between;
}
.funil-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.funil-card .empresa { font-size: 13px; font-weight: 700; color: var(--text); }
.funil-card .contato { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.funil-card .valor { font-size: 12px; color: var(--teal); font-weight: 700; margin-top: 6px; }
.funil-card select {
  margin-top: 8px;
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

/* ---------- Forms ---------- */

.form-row { margin-bottom: 12px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
}
.btn-sm {
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}
.btn-sm:hover { background: var(--navy-2); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg); }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input, .toolbar select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}

.loading { color: var(--text-muted); font-size: 13px; padding: 20px 0; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 18px 16px 40px; }
  .topbar-brand .name-full { display: none; }
}
