/* ============================================================
   ESTILO COMPARTILHADO — Digital Company
   ============================================================ */

:root {
  --navy: #001F3F;
  --navy-soft: #0A2E52;
  --gold: #B8860B;
  --gold-soft: #F4E9D8;
  --white: #FFFFFF;
  --stone: #778899;
  --stone-soft: #E4E8EC;
  --bordeaux: #800020;
  --bordeaux-soft: #F6E4E9;
  --bg: #F5F7F9;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--navy);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.glow {
  position: absolute;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,31,63,0.06) 0%, rgba(0,31,63,0) 70%);
  top: -180px; right: -180px;
  pointer-events: none;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--stone-soft);
  border-radius: var(--radius);
  padding: 40px 32px 32px;
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0,31,63,0.04), 0 12px 32px -16px rgba(0,31,63,0.12);
  text-align: left;
}

.mark { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.mark .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); display: inline-block; margin-right: 2px; }
.brand {
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13px;
  letter-spacing: 0.08em; color: var(--stone); text-transform: uppercase;
}

h1 { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 26px; line-height: 1.25; margin: 18px 0 6px; color: var(--navy); }
.sub { color: var(--stone); font-size: 14px; margin: 0 0 28px; line-height: 1.5; }

label {
  display: block; font-size: 11px; font-weight: 600; color: var(--stone);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em;
}
.field { margin-bottom: 18px; }

input {
  width: 100%; background: var(--white); border: 1.5px solid var(--stone-soft); border-radius: 8px;
  padding: 12px 14px; color: var(--navy); font-size: 15px; font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease;
}
input:focus { outline: none; border-color: var(--gold); }
input::placeholder { color: #A9B3BC; }

button.submit, a.submit, .submit {
  width: 100%; background: var(--navy); color: var(--white); border: none; border-radius: 8px;
  padding: 13px 14px; font-size: 15px; font-weight: 600; font-family: 'Inter', sans-serif;
  cursor: pointer; margin-top: 8px; transition: filter 0.15s ease, transform 0.1s ease;
  display: inline-block; text-align: center; box-sizing: border-box;
}
.submit:hover { filter: brightness(1.15); }
.submit:active { transform: scale(0.99); }
.submit:disabled { opacity: 0.6; cursor: not-allowed; }

.msg { font-size: 13px; margin-top: 14px; padding: 10px 12px; border-radius: 6px; display: none; line-height: 1.5; }
.msg.error { display: block; background: var(--bordeaux-soft); color: var(--bordeaux); border: 1px solid rgba(128,0,32,0.18); }
.msg.info { display: block; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(184,134,11,0.25); }

.foot { margin-top: 26px; font-size: 12px; color: var(--stone); text-align: center; }

.role-pill {
  display: inline-block; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 11px;
  letter-spacing: 0.04em; padding: 5px 12px; border-radius: 20px; background: var(--gold-soft); color: var(--gold); margin-top: 10px;
}

/* ============================================================
   MODAL (pop-up)
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,31,63,0.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: var(--white); border-radius: var(--radius); padding: 28px 28px 24px; box-shadow: 0 24px 64px -24px rgba(0,31,63,0.35); text-align: left; }
.modal-card-wide { max-width: 560px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h2 { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 20px; color: var(--navy); margin: 0; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--stone); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--navy); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

select, textarea {
  width: 100%; background: var(--white); border: 1.5px solid var(--stone-soft); border-radius: 8px;
  padding: 12px 14px; color: var(--navy); font-size: 15px; font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease;
}
select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; }

.funil-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
@media (max-width: 560px) { .funil-picker { grid-template-columns: 1fr; } }
.funil-opcao {
  text-align: left; background: var(--white); border: 1.5px solid var(--stone-soft); border-radius: 8px; padding: 14px 16px;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; display: flex; flex-direction: column; gap: 4px; font-family: 'Inter', sans-serif;
}
.funil-opcao:hover { border-color: var(--gold); background: var(--gold-soft); }
.funil-opcao strong { font-family: 'Montserrat', sans-serif; font-size: 14px; color: var(--navy); }
.funil-opcao span { font-size: 12px; color: var(--stone); line-height: 1.4; }

.link-voltar {
  background: none; border: none; color: var(--stone); font-size: 13px; cursor: pointer;
  padding: 0; margin-bottom: 16px; display: inline-flex; align-items: center; gap: 4px; font-family: 'Inter', sans-serif;
}
.link-voltar:hover { color: var(--navy); }

/* ============================================================
   APP SHELL — SIDEBAR (com suporte a colapsar)
   ============================================================ */
body.app-body { display: block; padding: 0; overflow: visible; align-items: initial; justify-content: initial; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--navy); color: var(--white);
  display: flex; flex-direction: column; padding: 28px 20px;
  position: sticky; top: 0; height: 100vh;
  transition: width 0.18s ease, padding 0.18s ease;
  overflow: hidden;
}
.sidebar.colapsada { width: 76px; padding-left: 16px; padding-right: 16px; }

.sidebar-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 36px; }
.sidebar-brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.sidebar-brand-text { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.85); white-space: nowrap; }
.sidebar.colapsada .sidebar-brand-text { display: none; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 8px;
  color: rgba(255,255,255,0.65); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease; white-space: nowrap;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.sidebar-link.active { background: rgba(184,134,11,0.18); color: var(--gold); font-weight: 600; }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; display: block; }
.sidebar.colapsada .sidebar-link { justify-content: center; padding: 11px; }
.sidebar.colapsada .sidebar-link-texto { display: none; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 16px; margin-top: 16px; }
.sidebar-user { font-size: 13px; color: rgba(255,255,255,0.75); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.colapsada .sidebar-user { display: none; }

.sidebar-logout {
  width: 100%; background: transparent; border: 1.5px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.75);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; font-family: 'Inter', sans-serif; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.sidebar-logout:hover { border-color: var(--gold); color: var(--gold); }
.sidebar-logout svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; display: block; }
.sidebar.colapsada .sidebar-logout-texto { display: none; }

.sidebar-toggle {
  width: 100%; background: transparent; border: none; color: rgba(255,255,255,0.45);
  padding: 10px 4px 0; font-size: 12px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 6px; font-family: 'Inter', sans-serif; transition: color 0.15s ease;
}
.sidebar-toggle:hover { color: var(--gold); }
.sidebar-toggle svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; display: block; transition: transform 0.18s ease; }
.sidebar.colapsada .sidebar-toggle svg { transform: rotate(180deg); }

.main-content { flex: 1; padding: 40px; min-width: 0; }
.page-header { margin-bottom: 28px; }
.page-header h1 { margin: 0 0 4px; }

.placeholder-card { background: var(--white); border: 1px solid var(--stone-soft); border-radius: var(--radius); padding: 56px 32px; text-align: center; color: var(--stone); }

/* ============================================================
   TABELA DE DADOS
   ============================================================ */
.filtro-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filtro-bar label { margin-bottom: 0; white-space: nowrap; }
.filtro-bar select { max-width: 280px; }

.data-table-wrapper { background: var(--white); border: 1px solid var(--stone-soft); border-radius: var(--radius); overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
  text-align: left; font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--stone); padding: 14px 16px;
  border-bottom: 1px solid var(--stone-soft); white-space: nowrap;
}
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--stone-soft); color: var(--navy); white-space: nowrap; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--bg); }

.tabela-vazio { text-align: center; color: var(--stone); padding: 40px !important; white-space: normal !important; }

.link-apagar { background: none; border: none; color: var(--bordeaux); font-size: 13px; font-family: 'Inter', sans-serif; cursor: pointer; padding: 0; }
.link-apagar:hover { text-decoration: underline; }

/* ============================================================
   CARDS DE KPI
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-card { background: var(--white); border: 1px solid var(--stone-soft); border-radius: var(--radius); padding: 20px; }
.kpi-card .kpi-label { font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--stone); margin-bottom: 8px; }
.kpi-card .kpi-valor { font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: 700; color: var(--navy); }

/* ============================================================
   PÍLULAS DE FUNIL
   ============================================================ */
.pills-funil-row { display: flex; flex-wrap: wrap; gap: 12px; }
.pill-funil {
  display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--white);
  border: 1.5px solid var(--stone-soft); border-radius: 999px; padding: 12px 24px; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: border-color 0.15s ease, background 0.15s ease;
}
.pill-funil:hover { border-color: var(--gold); }
.pill-funil.ativo { border-color: var(--navy); border-width: 2px; background: var(--stone-soft); }
.pill-funil strong { font-family: 'Montserrat', sans-serif; font-size: 14px; color: var(--navy); }
.pill-funil span { font-size: 12px; color: var(--stone); }

/* ============================================================
   GRÁFICO DE FUNIL
   ============================================================ */
.chart-card { background: var(--white); border: 1px solid var(--stone-soft); border-radius: var(--radius); padding: 28px 32px; margin-top: 4px; }
.chart-card-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 16px; color: var(--navy); margin: 0 0 20px; }
.funil-etapa { margin-bottom: 18px; }
.funil-etapa:last-child { margin-bottom: 0; }
.funil-etapa-header { display: flex; justify-content: space-between; font-size: 14px; color: var(--navy); margin-bottom: 6px; }
.funil-etapa-header small { color: var(--stone); font-weight: 500; }
.funil-barra-bg { background: var(--stone-soft); border-radius: 6px; height: 10px; overflow: hidden; }
.funil-barra { height: 100%; background: linear-gradient(90deg, var(--navy), var(--gold)); border-radius: 6px; transition: width 0.3s ease; }

/* ============================================================
   CARDS DE META
   ============================================================ */
.metas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.meta-card { background: var(--white); border: 1px solid var(--stone-soft); border-radius: var(--radius); padding: 20px; }
.meta-card-header h3 { font-family: 'Montserrat', sans-serif; font-size: 14px; font-weight: 700; color: var(--navy); margin: 0 0 6px; }
.meta-card-meta-info { font-size: 12px; color: var(--stone); margin-bottom: 12px; line-height: 1.5; }
.meta-card-valores { display: flex; justify-content: space-between; font-size: 13px; color: var(--navy); margin-top: 8px; }
.meta-card-actions { display: flex; gap: 16px; margin-top: 14px; }
.meta-editar { background: none; border: none; color: var(--stone); font-size: 13px; cursor: pointer; padding: 0; font-family: 'Inter', sans-serif; }
.meta-editar:hover { color: var(--navy); text-decoration: underline; }

/* ============================================================
   TABELAS ORDENÁVEIS + BOTÃO DE AMPLIAR
   ============================================================ */
.chart-card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.chart-card-header-row .chart-card-title { margin-bottom: 0; }
.btn-ampliar {
  background: none; border: 1px solid var(--stone-soft); border-radius: 6px; padding: 6px 12px; font-size: 12px;
  color: var(--stone); cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; font-family: 'Inter', sans-serif;
}
.btn-ampliar:hover { border-color: var(--gold); color: var(--navy); }
.th-ordenavel { cursor: pointer; user-select: none; }
.th-ordenavel:hover { color: var(--navy); }
.seta-ordenar { font-size: 10px; color: var(--stone); margin-left: 4px; }
.linha-clicavel { cursor: pointer; }
.link-voltar-geral { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--stone); text-decoration: none; margin-bottom: 16px; }
.link-voltar-geral:hover { color: var(--navy); }

/* ============================================================
   CARDS DE RESUMO POR EMPRESA — visão geral da equipe
   ============================================================ */
.empresas-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.empresa-overview-card { background: var(--white); border: 1px solid var(--stone-soft); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: border-color 0.15s ease; }
.empresa-overview-card:hover { border-color: var(--gold); }
.empresa-overview-card h3 { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 14px; color: var(--navy); margin: 0 0 12px; }
.empresa-overview-metrics { display: flex; flex-direction: column; gap: 8px; }
.empresa-overview-metrics .linha-metrica { display: flex; justify-content: space-between; font-size: 13px; }
.empresa-overview-metrics .linha-metrica span:first-child { color: var(--stone); }
.empresa-overview-metrics .linha-metrica span:last-child { color: var(--navy); font-weight: 600; }

/* ============================================================
   RESULTADO DIÁRIO — Ontem / Últimos 7 dias / Mensal
   ============================================================ */
.resultado-diario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .resultado-diario-grid { grid-template-columns: 1fr; } }
.resultado-diario-coluna h4 {
  font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 12px;
}

/* ============================================================
   ACORDEÃO DE LANÇAMENTO RÁPIDO (Atendimento / Vendas)
   ============================================================ */
.acordeao-item { border: 1px solid var(--stone-soft); border-radius: var(--radius); overflow: hidden; }
.acordeao-header {
  width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 12px 14px; background: none; border: none; cursor: pointer; text-align: left; font-family: 'Inter', sans-serif;
}
.acordeao-nome { font-size: 14px; font-weight: 600; font-family: 'Montserrat', sans-serif; color: var(--navy); }
.acordeao-resumo { display: block; font-size: 12px; color: var(--stone); margin-top: 2px; }
.acordeao-seta { font-size: 16px; color: var(--stone); transition: transform 0.15s ease; flex-shrink: 0; }
.acordeao-seta.aberto { transform: rotate(180deg); }
.acordeao-corpo { display: none; padding: 0 14px 14px; }
.acordeao-corpo.aberto { display: block; }

.canal-lista-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 6px;
}
.canal-lista-item button { background: none; border: none; cursor: pointer; color: var(--stone); font-size: 16px; }