/* ─── Variáveis ──────────────────────────────────────────────── */
:root {
  --navy:  #0B1929;
  --blue:  #1A5EAB;
  --teal:  #0B9E80;
  --amber: #D97706;
  --red:   #C0392B;
  --bg:    #F4F6FA;
  --card:  #FFFFFF;
  --text:  #1A202C;
  --muted: #718096;
  --radius: 10px;
}

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

body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

/* ─── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.navbar-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,0.75) !important;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff !important;
}

.navbar-usuario {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  white-space: nowrap;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.page-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}

.page-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ─── KPI Cards ──────────────────────────────────────────────── */
.kpi-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #E2E8F0;
  padding: 20px 24px;
  flex: 1;
  min-width: 180px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.kpi-titulo {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

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

.kpi-subtitulo {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* ─── Filiais Grid ───────────────────────────────────────────── */
.filiais-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}

.filial-card {
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid rgba(11,25,41,0.08);
  border-left: 4px solid #1A5EAB;
  box-shadow: 0 1px 4px rgba(11,25,41,0.06);
}
.filial-card.danger { border-left-color: #C0392B; }
.filial-card.warn   { border-left-color: #D97706; }
.filial-card.ok     { border-left-color: #0B9E80; }
.filial-card.none   { border-left-color: #8A9BB0; }

.filial-name  { font-size: 14px; font-weight: 600; color: #0B1929; margin-bottom: 8px; }
.filial-stats { display: flex; gap: 16px; font-size: 12px; color: #8A9BB0; flex-wrap: wrap; }
.filial-stats span strong { color: #0B1929; font-weight: 600; }

.filial-ratio          { margin-top: 10px; font-size: 22px; font-weight: 700; line-height: 1; }
.filial-ratio.danger   { color: #C0392B; }
.filial-ratio.warn     { color: #D97706; }
.filial-ratio.ok       { color: #0B9E80; }
.filial-ratio.none     { color: #8A9BB0; }
.filial-ratio-lbl      { font-size: 10px; color: #8A9BB0; margin-top: 1px; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge   { display:inline-block; padding:2px 8px; border-radius:4px; font-size:10.5px; font-weight:600; letter-spacing:.03em; }
.b-red   { background:#FEE2E2; color:#991B1B; }
.b-amber { background:#FEF3C7; color:#92400E; }
.b-teal  { background:#CCFBF1; color:#065F46; }
.b-blue  { background:#DBEAFE; color:#1E40AF; }
.b-gray  { background:#F1F5F9; color:#475569; }

/* ─── Insights ───────────────────────────────────────────────── */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.insight-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #E2E8F0;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.insight-titulo {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--navy);
}

.insight-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.acoes-lista {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.acoes-lista li {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

/* ─── Rodapé Churn ───────────────────────────────────────────── */
.rodape-churn {
  background: #EEF2FA;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 24px;
  line-height: 1.6;
}

/* ─── Login ──────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}

.login-card {
  background: var(--card);
  border-radius: 14px;
  padding: 48px 40px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.24);
}

.login-titulo {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}

.login-subtitulo {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: -8px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #CBD5E0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border 0.15s;
}

.login-input:focus { border-color: var(--blue); }

.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover { background: #144988; }

.login-erro {
  color: var(--red);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

/* ─── Utilidades ─────────────────────────────────────────────── */
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }

/* ─── Page header ─────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-title  { font-size: 28px; font-weight: 700; color: #0B1929; line-height: 1.1; margin-bottom: 0; }
.page-sub    { font-size: 13px; color: #8A9BB0; margin-top: 4px; }

/* ─── Metric cards (mcard) ────────────────────────────────────── */
.mcard {
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid rgba(11,25,41,0.08);
  box-shadow: 0 1px 4px rgba(11,25,41,0.06);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.mcard-val         { font-size: 34px; font-weight: 700; line-height: 1; color: #0B1929; margin-bottom: 4px; }
.mcard-val.teal    { color: #0B9E80; }
.mcard-val.warn    { color: #D97706; }
.mcard-val.danger  { color: #C0392B; }
.mcard-lbl         { font-size: 12px; color: #8A9BB0; font-weight: 500; }
.mcard-sub         { font-size: 11px; color: rgba(11,25,41,0.35); margin-top: 2px; }
.mcard-bar         { height: 3px; background: rgba(11,25,41,0.08); border-radius: 2px; margin-top: 14px; }
.mcard-bar-fill    { height: 100%; border-radius: 2px; transition: width 0.8s; }

/* ─── Chart card ──────────────────────────────────────────────── */
.chart-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid rgba(11,25,41,0.08);
  box-shadow: 0 1px 4px rgba(11,25,41,0.06);
}
.chart-card-title {
  font-size: 11px;
  font-weight: 600;
  color: #8A9BB0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

/* ─── Section divider ─────────────────────────────────────────── */
.section-divider {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8A9BB0;
  margin: 1.5rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(11,25,41,0.08);
}

/* ─── Progress bar ────────────────────────────────────────────── */
.pbar-wrap   { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pbar-label  { font-size: 11px; min-width: 100px; color: #0B1929; }
.pbar-track  { flex: 1; height: 6px; background: rgba(11,25,41,0.08); border-radius: 3px; overflow: hidden; }
.pbar-fill   { height: 100%; border-radius: 3px; }
.pbar-val    { font-size: 11px; font-weight: 600; min-width: 36px; text-align: right; color: #0B1929; }
.pbar-val.gray { color: #8A9BB0; }

/* ─── Alert boxes ────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  border-left: 3px solid;
  margin-bottom: 8px;
}
.alert strong { font-weight: 600; display: block; margin-bottom: 2px; }
.alert-red   { background: #FEF2F2; border-color: #C0392B; color: #7F1D1D; }
.alert-amber { background: #FFFBEB; border-color: #D97706; color: #78350F; }
.alert-teal  { background: #F0FDF4; border-color: #0B9E80; color: #14532D; }
.alert-blue  { background: #EFF6FF; border-color: #1A5EAB; color: #1E3A5F; }

/* ─── Cross cards ─────────────────────────────────────────────── */
.cross-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 8px; }
.cross-card        { background: #F4F7FB; border-radius: 8px; padding: 10px 12px; border: 1px solid rgba(11,25,41,0.08); }
.cross-card-filial { font-size: 10px; color: #8A9BB0; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.cross-card-prod   { font-size: 13px; font-weight: 600; color: #0B1929; margin-bottom: 6px; }
.cross-card-bar    { display: flex; align-items: center; gap: 6px; }
.cross-card-track  { flex: 1; height: 5px; background: rgba(11,25,41,0.08); border-radius: 3px; }
.cross-card-fill   { height: 100%; background: #1A5EAB; border-radius: 3px; }
.cross-card-val    { font-size: 12px; font-weight: 600; color: #0B1929; }
