:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ========================= Layout principal (sidebar) ==================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-logo-wrap {
  padding: 1.1rem 1.2rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.topbar-logo {
  height: 44px;
  width: auto;
  max-width: 180px;
  display: block;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: .5rem 0;
}
.sidebar nav a {
  padding: .72rem 1.2rem;
  font-size: .88rem;
  color: #cbd5e1;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active {
  background: rgba(37,99,235,.25);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--primary);
}

.sidebar-footer {
  padding: .8rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.user-box { display: flex; flex-direction: column; gap: .35rem; }
.user-name { color: #e2e8f0; font-size: .78rem; }
.user-name small { color: #94a3b8; display: block; }

/* ---------- Conteúdo principal ---------- */
.app-content {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
}

/* ---------- Topbar móvel (hamburger) ---------- */
.topbar {
  display: none; /* oculto em desktop */
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  height: 56px;
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .topbar-logo { height: 38px; max-width: 150px; }

/* ================================ Login ================================= */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #0f172a, #1e293b);
}
.login-card {
  background: #fff; border-radius: 14px; padding: 2.2rem;
  width: min(380px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.login-logo { margin: 0; font-size: 1.4rem; color: #0f172a; text-align: center; }
.login-sub { margin: .25rem 0 1.5rem; text-align: center; color: var(--muted); font-size: .9rem; }
.login-btn { width: 100%; margin-top: .5rem; justify-content: center; }
.login-hint { margin-top: 1.2rem; text-align: center; font-size: .78rem; color: var(--muted); }
.login-hint code { background: #f1f5f9; padding: .1rem .35rem; border-radius: 4px; }

/* ========================= Validador de CNPJ =========================== */
.agent-tag { font-size: .7rem; background: #ede9fe; color: #6d28d9; padding: .15rem .5rem; border-radius: 999px; vertical-align: middle; }

.rec-banner {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem;
  border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--line);
}
.rec-banner strong { font-size: 1.05rem; }
.rec-banner p { margin: .2rem 0 0; font-size: .85rem; opacity: .85; }
.rec-icon { font-size: 1.8rem; }
.rec-human { margin-left: auto; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.rec-ok     { background: #dcfce7; border-color: #86efac; color: #166534; }
.rec-warn   { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.rec-review { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.rec-link   { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.rec-block  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

.dup-warn { background: #fef3c7; border: 1px solid #fde047; color: #854d0e; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .88rem; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: .4rem .8rem; margin: 0; font-size: .86rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.st { padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.st-ok    { background: #dcfce7; color: #166534; }
.st-bad   { background: #fee2e2; color: #991b1b; }
.st-warn  { background: #fef3c7; color: #854d0e; }
.st-muted { background: #f1f5f9; color: #64748b; }

.alerts { margin-top: 1rem; font-size: .84rem; }
.alerts ul { margin: .3rem 0 0; padding-left: 1.2rem; color: #854d0e; }
.ok-msg { color: #166534; font-weight: 600; margin-top: 1rem; }

/* ======================= Qualificador de Leads ========================= */
.lead-picker { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .88rem; }

.qual-result { border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.qual-result.cl-hot  { background: linear-gradient(135deg,#fff1f2,#ffe4e6); border-color: #fecaca; }
.qual-result.cl-warm { background: linear-gradient(135deg,#fffbeb,#fef3c7); border-color: #fde68a; }
.qual-result.cl-cold { background: linear-gradient(135deg,#eff6ff,#dbeafe); border-color: #bfdbfe; }

.qual-headline { display: flex; align-items: center; gap: 1rem; }
.qual-icon { font-size: 2.4rem; }
.qual-class { font-size: 1.5rem; font-weight: 800; letter-spacing: .04em; display: block; }
.qual-score { font-size: .8rem; color: var(--muted); }
.qual-badges { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.qual-resumo { margin: .8rem 0 .5rem; font-size: .9rem; }
.qual-action { font-size: .92rem; background: rgba(255,255,255,.6); padding: .6rem .8rem; border-radius: 8px; }
.qual-motivo { font-size: .85rem; color: var(--muted); }
.qual-result .badge.alta  { background:#fee2e2; color:#991b1b; }
.qual-result .badge.media { background:#fef3c7; color:#92400e; }
.qual-result .badge.baixa { background:#e0f2fe; color:#075985; }

.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.15rem; }

.filters { display: flex; gap: .75rem; margin-bottom: 1rem; }
.filters input, .filters select {
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem;
}
.filters input { flex: 1; }

.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid th, .grid td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--line); }
.grid th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.grid tbody tr:hover { background: #f9fafb; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

.badge { padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge.novo { background: #dbeafe; color: #1e40af; }
.badge.em_contato { background: #fef3c7; color: #92400e; }
.badge.qualificado { background: #dcfce7; color: #166534; }
.badge.nao_qualificado { background: #f3f4f6; color: #4b5563; }
.badge.convertido { background: #ccfbf1; color: #115e59; }
.badge.perdido { background: #fee2e2; color: #991b1b; }

.btn {
  padding: .5rem .9rem; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-link { border: none; background: none; color: var(--primary); cursor: pointer; font-size: .82rem; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; width: min(560px, 92vw); }
.modal-card h3 { margin: 0 0 1rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-grid label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: .25rem; }
.form-grid input { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; font-size: .9rem; color: var(--text); }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
.error { color: #dc2626; font-size: .82rem; min-height: 1rem; margin: .5rem 0 0; }

/* ============================ Kanban / Funil ============================ */
.container-wide { max-width: 1500px; }
.subtitle { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }

/* Layout full-viewport para a página do funil: sem scroll vertical na página */
.page-kanban .app-content {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.page-kanban main,
.page-kanban main.container,
.page-kanban main.container-wide {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: .75rem 1.25rem;
  max-width: none;
  margin: 0;
  width: 100%;
}
.page-kanban .panel-head { flex-shrink: 0; margin-bottom: .6rem; }
.page-kanban .kanban {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
  padding-bottom: .5rem;
}
.page-kanban .kanban-col {
  max-height: none;
  height: 100%;
}


.btn-sm { padding: .3rem .55rem; font-size: .78rem; }
.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.kanban {
  display: flex;
  gap: .85rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 270px;
  background: #eef1f5;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}

.kanban-col-head {
  padding: .7rem .8rem;
  border-top: 3px solid #94a3b8;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #fff;
}
.kanban-col-title { display: flex; align-items: center; gap: .5rem; }
.kanban-col-title strong { font-size: .9rem; }
.pill { background: #e2e8f0; color: #475569; border-radius: 999px; padding: 0 .5rem; font-size: .72rem; font-weight: 700; }
.kanban-col-totals { margin-top: .3rem; display: flex; justify-content: space-between; align-items: baseline; }
.kanban-col-totals span { font-weight: 700; font-size: .88rem; color: #0f172a; }
.kanban-col-totals small { color: var(--muted); font-size: .72rem; }

.kanban-cards {
  padding: .6rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
  transition: background .15s;
}
.kanban-cards.drop-hover { background: #dbeafe; outline: 2px dashed var(--primary); outline-offset: -4px; }
.col-hint { color: #94a3b8; font-size: .78rem; text-align: center; margin: 1rem .5rem; font-style: italic; }

.kanban-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .6rem .7rem;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-card h4 { margin: 0 0 .2rem; font-size: .86rem; line-height: 1.25; }
.kanban-card-customer { margin: 0 0 .45rem; color: var(--muted); font-size: .78rem; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: baseline; }
.kanban-card-meta .value { font-weight: 700; font-size: .85rem; color: #0f172a; }
.kanban-card-meta .forecast { font-size: .72rem; color: var(--primary); }
.kanban-card-foot { margin-top: .4rem; font-size: .72rem; color: var(--muted); }

/* extras de formulário usados nos modais do funil */
.modal-sm { width: min(420px, 92vw); }
.col-2 { grid-column: 1 / -1; }
.block { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); margin-bottom: .8rem; }
.block input, .block select, .block textarea { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; font-size: .9rem; color: var(--text); font-family: inherit; }
.select-row { display: flex; gap: .4rem; }
.select-row select { flex: 1; }
.form-grid select { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; font-size: .9rem; color: var(--text); }
.form-grid textarea { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; font-family: inherit; }

/* ============================== Dashboard =============================== */
.panel-title { margin: 0 0 1rem; font-size: 1rem; }
.panel-title small { color: var(--muted); font-weight: 400; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .8rem;
  margin-bottom: 1.2rem;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid #94a3b8;
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.kpi.blue  { border-left-color: var(--primary); }
.kpi.green { border-left-color: #16a34a; }
.kpi.red   { border-left-color: #dc2626; }
.kpi-label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 1.35rem; font-weight: 700; color: #0f172a; }

.dash-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) { .dash-row { grid-template-columns: 1fr; } }

/* Kanban mobile: desativa o layout full-viewport travado */
@media (max-width: 768px) {
  .page-kanban .app-content {
    height: auto;
    overflow: visible;
  }
  .page-kanban main,
  .page-kanban main.container,
  .page-kanban main.container-wide {
    overflow: visible;
    flex: none;
    padding: .75rem;
  }
  .page-kanban .kanban {
    overflow-x: auto;
    overflow-y: visible;
    align-items: flex-start;
    padding-bottom: 1rem;
  }
  .page-kanban .kanban-col {
    flex: 0 0 240px;
    max-height: none;
    height: auto;
  }
  .kanban-col { max-height: none; }
  .kanban-cards { overflow-y: visible; }
}

.chart { display: flex; flex-direction: column; gap: .6rem; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 110px; align-items: center; gap: .6rem; }
.bar-label { font-size: .82rem; }
.bar-label small { color: var(--muted); }
.bar-track { background: #eef1f5; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .4s ease; min-width: 2px; }
.bar-value { text-align: right; font-size: .82rem; font-weight: 600; color: #0f172a; }

.badge.alta  { background: #fee2e2; color: #991b1b; }
.badge.media { background: #fef3c7; color: #92400e; }
.badge.baixa { background: #e0f2fe; color: #075985; }

/* ============================== Atividades ============================== */
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.tab {
  padding: .45rem .9rem; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; cursor: pointer; font-size: .85rem; color: var(--muted);
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.row-overdue { background: #fef2f2; }
.row-overdue td:first-child { border-left: 3px solid #dc2626; font-weight: 600; color: #991b1b; }

/* % de atingimento de meta */
.pct { font-weight: 700; padding: .1rem .45rem; border-radius: 999px; font-size: .78rem; }
.pct-ok  { background: #dcfce7; color: #166534; }
.pct-mid { background: #fef3c7; color: #92400e; }
.pct-low { background: #fee2e2; color: #991b1b; }

/* ============================== Higiene / Dedup ========================== */
.ok-msg { color: #166534; font-weight: 600; font-size: 1rem; padding: .5rem 0; }

.dup-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .8rem;
  background: #fff;
}
.dup-title {
  font-weight: 600;
  font-size: .9rem;
  color: #0f172a;
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--line);
}

.dup-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .2rem;
  cursor: pointer;
  border-radius: 4px;
}
.dup-row:hover { background: #f8fafc; }
.dup-name { flex: 1; font-size: .88rem; }

.dup-pair {
  display: flex;
  gap: 1.5rem;
  font-size: .88rem;
  color: #374151;
  margin-bottom: .6rem;
}
.dup-pair span { flex: 1; }

.row-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  margin-top: .7rem;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ====================== Hamburger (mobile only) ====================== */
.hamburger-btn {
  display: none; /* visível só no mobile */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: rgba(255,255,255,.1); }
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #cbd5e1;
  border-radius: 2px;
  transition: all .25s ease;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
.nav-overlay.open { display: block; }

/* ====================== Responsivo Global =================== */

/* Tablet: ≤ 1024px — sidebar mais estreita */
@media (max-width: 1024px) {
  .sidebar { width: 190px; }
  .app-content { margin-left: 190px; }
  .container { padding: 0 .75rem; }
  .container-wide { padding: 0 .75rem; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .bar-row { grid-template-columns: 110px 1fr 90px; }
}

/* Mobile: ≤ 768px — sidebar vira drawer, topbar aparece */
@media (max-width: 768px) {
  /* --- Sidebar vira drawer lateral --- */
  .sidebar {
    width: min(260px, 80vw);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0,0,0,.5);
  }

  /* --- Topbar móvel aparece --- */
  .topbar { display: flex; }
  .hamburger-btn { display: flex; }

  /* --- Conteúdo sem margem (topbar substitui) --- */
  .app-content { margin-left: 0; }

  /* === Topbar === */
  .topbar { height: auto; padding: .6rem 1rem; gap: .5rem; flex-wrap: nowrap; }
  .topbar .topbar-logo { height: 38px; max-width: 160px; flex-shrink: 0; }

  /* === Container === */
  .container,
  .container-wide { margin: .75rem auto; padding: 0 .75rem; }

  /* === Panel === */
  .panel { padding: .9rem; overflow-x: auto; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .panel-head h2 { font-size: 1rem; }
  .panel-head > div:last-child,
  .panel-head > button { align-self: stretch; }
  .panel-head .btn { width: 100%; justify-content: center; }

  /* === Filtros === */
  .filters { flex-direction: column; gap: .5rem; }
  .filters input,
  .filters select { width: 100%; font-size: 1rem; }
  .panel-head .filters { margin-bottom: 0; width: 100%; }
  .audit-filters { flex-direction: column !important; }
  .audit-filters label { width: 100%; }
  .audit-filters select,
  .audit-filters input[type="date"] { width: 100%; font-size: 1rem; }
  .audit-filters .btn { width: 100%; }
  .report-actions { width: 100%; flex-direction: column !important; }
  .report-actions input,
  .report-actions .btn { width: 100%; }

  /* === Tabelas: scroll horizontal === */
  .grid { min-width: 480px; font-size: .82rem; }
  .grid th, .grid td { padding: .55rem .5rem; }

  /* === Botões === */
  .btn { font-size: .9rem; padding: .55rem 1rem; touch-action: manipulation; }
  .btn-sm { font-size: .82rem; padding: .4rem .7rem; }

  /* === Abas (tabs) === */
  .tabs { flex-wrap: wrap; gap: .3rem; }
  .tab { font-size: .82rem; padding: .4rem .7rem; }

  /* === Modal: sobe do rodapé (bottom sheet) === */
  .modal { align-items: flex-end; padding-bottom: 0; }
  .modal-card {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.25rem 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* === Formulários === */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.col-2 { grid-column: 1; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; justify-content: center; }

  /* === Dashboard: KPIs === */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .kpi-value { font-size: 1.1rem; }

  /* === Dashboard: gráfico de barras === */
  .bar-row { grid-template-columns: 90px 1fr 70px; gap: .4rem; font-size: .78rem; }
  .bar-label { font-size: .76rem; }

  /* === Dashboard: dash-row (chart + ranking) === */
  .dash-row { grid-template-columns: 1fr; }

  /* === CNPJ: rec-banner === */
  .rec-banner { flex-wrap: wrap; gap: .6rem; }
  .rec-human { margin-left: 0; }

  /* === Qualificador === */
  .qual-headline { flex-wrap: wrap; }
  .qual-badges { margin-left: 0; margin-top: .4rem; }
  .qual-class { font-size: 1.2rem; }

  /* === KV (chave-valor) === */
  .kv { grid-template-columns: 100px 1fr; }

  /* === Churn / Higiene: dup-pair === */
  .dup-pair { flex-direction: column; gap: .4rem; }
}

/* Telas muito pequenas: ≤ 400px */
@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1rem; }
  .kpi-label { font-size: .7rem; }
  .topbar-logo { max-width: 120px; }
  .tabs { gap: .2rem; }
  .tab { font-size: .78rem; padding: .35rem .55rem; }
}

/* ====================== Cookie Banner ====================== */
#cookie-banner {
  position: fixed;
  bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  width: min(680px, 94vw);
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 9999;
  box-shadow: 0 4px 32px rgba(0,0,0,.45);
  border-radius: 12px;
  border: 1px solid #334155;
  font-size: .85rem;
  line-height: 1.5;
}
#cookie-banner p { margin: 0; flex: 1; min-width: 200px; }
#cookie-banner a { color: #38bdf8; text-decoration: underline; }
#cookie-banner .cookie-actions { display: flex; gap: .6rem; flex-shrink: 0; }
#cookie-banner.hidden { display: none; }
