/* ==========================================================================
   Advisor P2 — design system
   Paleta e tipografia extraídas do site Advisor Partners (advisortalks.com.br):
     - Azul-marinho primário .......... #002C58  (cor de marca dominante)
     - Dourado/âmbar de destaque ...... #F6A723  (accent principal)
     - Dourado claro (hover) .......... #EEAD62
     - Rosa/coral (destaque quente) ... #FC4668
     - Grafite (texto) ................ #535254
     - Quase-preto (dark) ............. #131D26
     - Fonte .......................... Archivo (títulos e corpo)
   Tudo centralizado em variáveis para ajuste fácil.
   ========================================================================== */

:root {
  /* Cores de marca */
  --color-primary:        #002C58;
  --color-primary-800:    #002247;
  --color-primary-600:    #113a6b;
  --color-accent:         #F6A723;
  --color-accent-600:     #e0930f;
  --color-accent-soft:    #EEAD62;
  --color-hot:            #FC4668;

  /* Neutros / superfícies — paleta executiva, cinza azulado suave */
  --color-bg:             #F0F4F8;   /* Cinza Azulado Suave (fundo) */
  --color-surface:        #ffffff;
  --color-surface-alt:    #E6ECF3;
  --color-border:         #D9E1EA;
  --color-text:           #1c2530;
  --color-text-muted:     #566172;
  --color-text-invert:    #ffffff;

  /* Status */
  --status-novo:            #113a6b;
  --status-novo-bg:         #e6eef8;
  --status-em_atendimento:  #b57200;
  --status-em_atendimento-bg:#fdf1dd;
  --status-concluido:       #1f7a4d;
  --status-concluido-bg:    #e2f4ea;

  /* Tipografia */
  --font-heading: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Forma */
  --radius:      12px;
  --radius-sm:   8px;
  --shadow-sm:   0 1px 2px rgba(16, 32, 56, .06);
  --shadow-md:   0 6px 20px rgba(16, 32, 56, .10);
  --shadow-lg:   0 14px 40px rgba(16, 32, 56, .14);
  --maxw:        1080px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  line-height: 1.15;
  margin: 0 0 .4em;
  letter-spacing: -.01em;
}
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }

a { color: var(--color-primary-600); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---- Cabeçalho / marca --------------------------------------------------- */
.site-header {
  background: var(--color-primary);
  color: var(--color-text-invert);
  box-shadow: var(--shadow-md);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand .wordmark {
  font-family: var(--font-heading);
  font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em;
  color: var(--color-text-invert);
}
.brand .wordmark .p2 { color: var(--color-accent); }
.brand .byline {
  font-size: .72rem; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: rgba(255,255,255,.65);
}
/* Co-brand: marca Advisor Partners ao lado do Advisor P2 */
.brand-divider { width: 1px; height: 28px; background: rgba(255,255,255,.22); }
.ap-lockup { display: flex; align-items: center; gap: 8px; }
.ap-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--color-accent); color: var(--color-primary);
  font-family: var(--font-heading); font-weight: 800; font-size: .82rem;
  letter-spacing: -.03em; display: grid; place-items: center;
}
.ap-keys { width: 34px; height: 36px; display: block; flex-shrink: 0; }

/* Banner de boas-vindas (advisor) */
.welcome-banner {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 24px; font-size: .95rem;
  color: var(--color-text-muted); line-height: 1.55; box-shadow: var(--shadow-sm);
}
.welcome-banner strong { color: var(--color-primary); font-weight: 700; }

/* Realce de usuário pendente na gestão */
.user-row.is-pending { background: var(--status-em_atendimento-bg); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.ap-name {
  font-family: var(--font-heading); font-size: .66rem; font-weight: 700;
  line-height: 1.06; letter-spacing: .04em; text-transform: uppercase;
  color: rgba(255,255,255,.82);
}
.site-header nav { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
/* Dropdown "Mais" */
.nav-more { position: relative; }
.nav-more > summary {
  cursor: pointer; list-style: none; color: rgba(255,255,255,.85);
  font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 5px;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: "▾"; font-size: .72rem; }
.nav-more[open] > summary, .nav-more.has-active > summary { color: var(--color-accent); }
.nav-more-menu {
  position: absolute; right: 0; top: calc(100% + 12px);
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; min-width: 220px;
  display: flex; flex-direction: column; z-index: 50;
}
.nav-more-menu a {
  color: var(--color-text) !important; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 600;
}
.nav-more-menu a:hover { background: var(--color-surface-alt); color: var(--color-primary) !important; }
.nav-more-menu a.active { background: var(--color-surface-alt); color: var(--color-primary) !important; }
.site-header nav a {
  color: rgba(255,255,255,.85); text-decoration: none;
  font-weight: 600; font-size: .92rem;
}
.site-header nav a:hover, .site-header nav a.active { color: var(--color-accent); }

/* ---- Layout de página ---------------------------------------------------- */
main { padding: 40px 0 72px; }
.page-intro { margin-bottom: 28px; }
.page-intro p { color: var(--color-text-muted); max-width: 62ch; margin: 0; }
.eyebrow {
  display: inline-block; font-size: .74rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-accent-600); margin-bottom: 8px;
}

/* ---- Cartões de produto (home) ------------------------------------------- */
.card-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.product-card {
  display: flex; flex-direction: column;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 26px 24px 22px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg); border-color: var(--color-accent);
}
.product-card .ico {
  width: 46px; height: 46px; border-radius: 10px;
  display: grid; place-items: center; margin-bottom: 16px;
  background: var(--color-surface-alt); color: var(--color-primary);
}
.product-card .ico svg { width: 24px; height: 24px; }
.product-card h3 { margin-bottom: 6px; }
.product-card p { color: var(--color-text-muted); font-size: .92rem; margin: 0 0 18px; flex: 1; }
.product-card .cta {
  font-weight: 700; color: var(--color-primary-600); font-size: .92rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.product-card:hover .cta { color: var(--color-accent-600); }

/* ---- Cartão genérico / formulário --------------------------------------- */
.panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 28px;
}
.form-shell { max-width: 720px; margin: 0 auto; }

/* Stepper */
.stepper { display: flex; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.stepper .step {
  display: flex; align-items: center; gap: 8px; font-size: .82rem;
  color: var(--color-text-muted); font-weight: 600;
}
.stepper .step .dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--color-surface-alt); color: var(--color-text-muted);
  font-size: .8rem; border: 1px solid var(--color-border);
}
.stepper .step.active .dot { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.stepper .step.done .dot { background: var(--color-accent); color: var(--color-primary-800); border-color: var(--color-accent); }
.stepper .step.active { color: var(--color-primary); }
.stepper .sep { flex: 1; height: 1px; background: var(--color-border); align-self: center; min-width: 12px; }

.step-head { margin-bottom: 20px; }
.step-head .count { font-size: .8rem; font-weight: 700; color: var(--color-accent-600); letter-spacing: .06em; text-transform: uppercase; }
.step-head h2 { margin: 4px 0 2px; }
.step-head .hint { color: var(--color-text-muted); font-size: .92rem; margin: 0; }

/* Campos */
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field .req { color: var(--color-hot); }
.field .sub { color: var(--color-text-muted); font-weight: 400; font-size: .85rem; }
.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=number],
.field textarea,
.field select {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--color-text);
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--color-primary-600);
  box-shadow: 0 0 0 3px rgba(17,58,107,.12);
}
.field .error-msg { color: var(--color-hot); font-size: .82rem; margin-top: 6px; display: none; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--color-hot); }
.field.invalid .error-msg { display: block; }

/* Opções em cartão (radio-cards) */
.option-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.option-card {
  position: relative; display: block; cursor: pointer;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 16px 16px 15px; background: #fff; transition: border-color .12s, box-shadow .12s, background .12s;
}
.option-card:hover { border-color: var(--color-accent-soft); }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card .opt-title { font-weight: 700; color: var(--color-primary); }
.option-card .opt-hint { font-size: .84rem; color: var(--color-text-muted); margin-top: 3px; }
.option-card.selected {
  border-color: var(--color-primary); background: #f5f9ff;
  box-shadow: 0 0 0 3px rgba(17,58,107,.10);
}
.option-card.selected::after {
  content: "✓"; position: absolute; top: 10px; right: 12px;
  color: var(--color-accent-600); font-weight: 800;
}
.option-grid.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.option-card.disabled {
  cursor: not-allowed; opacity: .7; background: var(--color-surface-alt);
  border-style: dashed; border-color: var(--color-border);
}
.option-card.disabled .opt-title { color: var(--color-text-muted); }
.opt-soon {
  position: absolute; top: 10px; right: 12px; font-size: .64rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; color: var(--color-accent-600);
  background: #fff; border: 1px solid var(--color-accent-soft); padding: 2px 8px; border-radius: 999px;
}

/* Botões */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: .95rem;
  padding: 11px 22px; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .12s, color .12s, border-color .12s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-800); }
.btn-accent { background: var(--color-accent); color: var(--color-primary-800); }
.btn-accent:hover { background: var(--color-accent-600); color: #fff; }
.btn-ghost { background: transparent; color: var(--color-primary); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-primary); }
.btn-wa { background: #25D366; color: #05391b; }
.btn-wa:hover { background: #1eb85a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 13px; font-size: .84rem; }

.form-nav { display: flex; justify-content: space-between; margin-top: 26px; gap: 12px; }

/* Revisão */
.review-list { list-style: none; margin: 0; padding: 0; }
.review-group { margin-bottom: 18px; }
.review-group h4 { color: var(--color-primary); border-bottom: 1px solid var(--color-border); padding-bottom: 6px; margin-bottom: 10px; }
.review-row { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; font-size: .92rem; }
.review-row .k { color: var(--color-text-muted); }
.review-row .v { font-weight: 600; text-align: right; }

/* Sucesso */
.success-box { text-align: center; padding: 20px 10px; }
.success-box .check {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  background: var(--status-concluido-bg); color: var(--status-concluido);
  display: grid; place-items: center; font-size: 2rem; font-weight: 800;
}
.success-box .protocol {
  display: inline-block; margin: 10px 0 22px; font-weight: 700;
  background: var(--color-surface-alt); padding: 6px 14px; border-radius: 999px;
}

/* ==========================================================================
   Painel do atendente
   ========================================================================== */
.counters { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 24px; }
.counter {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.counter .n { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
.counter .l { font-size: .82rem; color: var(--color-text-muted); font-weight: 600; margin-top: 4px; }
.counter.accent { border-top: 3px solid var(--color-accent); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.toolbar .filter { display: flex; flex-direction: column; gap: 4px; }
.toolbar .filter label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); }
.toolbar select { padding: 8px 12px; font: inherit; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; }
.toolbar .spacer { flex: 1; }

.subs-list { display: flex; flex-direction: column; gap: 14px; }
.sub-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
/* Bordas monocromáticas (executivo) — o produto é identificado pela tag. */
.sub-card.p-credito,
.sub-card.p-protecao,
.sub-card.p-consorcio,
.sub-card.p-cambio     { border-left-color: var(--color-primary); }
.sub-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sub-top .who { }
.sub-top .who .name { font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; color: var(--color-primary); }
.sub-top .who .phone { color: var(--color-text-muted); font-size: .9rem; }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; letter-spacing: .03em;
}
.tag.product { background: var(--color-surface-alt); color: var(--color-primary); }
.tag.advisor { background: var(--color-primary); color: #fff; font-size: .62rem; vertical-align: middle; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem;
  font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.badge.novo { background: var(--status-novo-bg); color: var(--status-novo); }
.badge.em_atendimento { background: var(--status-em_atendimento-bg); color: var(--status-em_atendimento); }
.badge.concluido { background: var(--status-concluido-bg); color: var(--status-concluido); }
.sub-summary { margin: 12px 0; color: var(--color-text); font-size: .95rem; }
.sub-meta { font-size: .82rem; color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: 14px; }
.sub-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.sub-actions .status-select { display: flex; align-items: center; gap: 8px; }
.sub-actions select { padding: 7px 11px; font: inherit; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; }
.empty {
  text-align: center; padding: 60px 20px; color: var(--color-text-muted);
  background: var(--color-surface); border: 1px dashed var(--color-border); border-radius: var(--radius);
}

/* ==========================================================================
   Gestão de usuários
   ========================================================================== */
.users-layout { display: grid; gap: 22px; grid-template-columns: 340px 1fr; align-items: start; }
.user-form-panel h2, .users-list-panel h2 { font-size: 1.15rem; margin-bottom: 16px; }
.users-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.users-list-head h2 { margin-bottom: 0; }
#users-list { display: flex; flex-direction: column; }
.user-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--color-border);
}
.user-row:last-child { border-bottom: none; }
.user-name { font-weight: 700; color: var(--color-primary); }
.user-sub { font-size: .85rem; color: var(--color-text-muted); margin-top: 2px; }
.user-role select, .role-change {
  padding: 7px 11px; font: inherit; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); background: #fff;
}
.user-actions { display: flex; gap: 8px; }
.btn-danger { background: #fff; color: var(--color-hot); border-color: var(--color-hot); }
.btn-danger:hover:not(:disabled) { background: var(--color-hot); color: #fff; }

@media (max-width: 820px) {
  .users-layout { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr; gap: 8px; }
  .user-actions { flex-wrap: wrap; }
}

/* Rodapé */
.site-footer { border-top: 1px solid var(--color-border); padding: 26px 0; color: var(--color-text-muted); font-size: .85rem; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--color-primary); color: #fff; padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
  font-weight: 600; font-size: .9rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--color-hot); }

/* ---- Área de sessão no cabeçalho ---------------------------------------- */
.session-area { display: inline-flex; align-items: center; gap: 12px; }
.session-user { font-size: .85rem; color: rgba(255,255,255,.9); font-weight: 600; }
.session-role { color: var(--color-accent); font-weight: 700; }
.session-logout {
  font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
  color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.35);
  padding: 5px 12px; border-radius: 999px; transition: border-color .12s, background .12s;
}
.session-logout:hover { border-color: var(--color-accent); background: rgba(246,167,35,.14); }
.session-user { text-decoration: none; }
.session-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; background: #fff; border: 1px solid rgba(255,255,255,.25); flex-shrink: 0; }

/* ---- Perfil / Minha conta ----------------------------------------------- */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid .field { margin-bottom: 0; }
.logo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo-preview {
  width: 88px; height: 88px; border-radius: 14px; border: 1px solid var(--color-border);
  background: var(--color-surface-alt); display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview span { color: var(--color-text-muted); font-size: .78rem; }
.logo-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Comissões (fee) ---------------------------------------------------- */
.comm-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--color-border); }
.comm-row:last-child { border-bottom: none; }
.comm-row.is-edit { grid-template-columns: 1fr auto; }
.comm-title { font-weight: 700; color: var(--color-primary); }
.comm-adv { font-size: .8rem; color: var(--color-text-muted); font-weight: 600; }
.comm-sub { font-size: .84rem; color: var(--color-text-muted); margin-top: 2px; }
.comm-value { font-family: var(--font-heading); font-weight: 800; color: var(--color-primary); font-size: 1.02rem; }
.comm-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comm-money { display: flex; align-items: center; gap: 4px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0 10px; background: #fff; }
.comm-money span { color: var(--color-text-muted); font-size: .85rem; }
.comm-money input { border: none; padding: 9px 2px; width: 96px; font: inherit; outline: none; background: transparent; }
.comm-select { padding: 8px 11px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; font: inherit; }
@media (max-width: 620px) { .comm-row, .comm-row.is-edit { grid-template-columns: 1fr; } }

/* ---- Esteira (kanban) --------------------------------------------------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kb-col { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.kb-col-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-weight: 700; color: var(--color-primary); background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); font-size: .92rem; }
.kb-count { background: var(--color-primary); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: .78rem; }
.kb-col-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kb-card { background: #fff; border: 1px solid var(--color-border); border-left: 3px solid var(--color-primary); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.kb-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kb-proto { font-size: .74rem; color: var(--color-text-muted); font-weight: 700; }
.kb-client { font-weight: 700; color: var(--color-primary); }
.kb-sub { font-size: .84rem; color: var(--color-text-muted); margin: 3px 0 8px; }
.kb-meta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--color-text-muted); gap: 10px; }
.kb-empty { color: var(--color-text-muted); font-size: .84rem; text-align: center; padding: 14px 0; }
@media (max-width: 820px) { .kanban { grid-template-columns: 1fr; } }

/* ---- Advisor Sprint (guia de objeções) ---------------------------------- */
.sprint { border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 12px; background: var(--color-surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.sprint summary { cursor: pointer; padding: 15px 18px; font-weight: 700; color: var(--color-primary); display: flex; align-items: center; gap: 10px; list-style: none; font-size: 1.02rem; }
.sprint summary::-webkit-details-marker { display: none; }
.sprint summary::after { content: "+"; margin-left: auto; color: var(--color-text-muted); font-weight: 700; font-size: 1.2rem; }
.sprint[open] summary::after { content: "–"; }
.sprint-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.sprint-body { padding: 2px 18px 14px; }
.obj { border-top: 1px solid var(--color-border); padding: 12px 0; }
.obj:first-child { border-top: none; }
.obj-q { font-weight: 700; color: var(--color-text); margin: 0 0 4px; }
.obj-a { color: var(--color-text-muted); font-size: .93rem; margin: 0; line-height: 1.55; }

/* ---- Instituições ------------------------------------------------------- */
.inst-block { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.inst-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.inst-head h2 { margin: 0; font-size: 1.15rem; }
.inst-ico { display: grid; place-items: center; }
.inst-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.inst-chip { background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 999px; padding: 8px 16px; font-weight: 600; color: var(--color-primary); font-size: .92rem; }
.inst-empty { color: var(--color-text-muted); font-size: .92rem; background: var(--color-surface-alt); border: 1px dashed var(--color-border); border-radius: var(--radius-sm); padding: 14px 16px; }

/* ---- Chat -------------------------------------------------------------- */
.chat-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
.chat-wrap.with-threads { grid-template-columns: 280px 1fr; }
.chat-threads { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow-y: auto; max-height: 560px; box-shadow: var(--shadow-sm); }
.chat-threads-head { padding: 12px 16px; font-weight: 700; color: var(--color-primary); background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; }
.chat-thread { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--color-border); background: #fff; padding: 12px 16px; cursor: pointer; }
.chat-thread:hover { background: var(--color-surface-alt); }
.chat-thread.active { background: var(--color-surface-alt); box-shadow: inset 3px 0 0 var(--color-accent); }
.chat-thread-name { font-weight: 700; color: var(--color-primary); font-size: .88rem; word-break: break-all; }
.chat-thread-last { font-size: .8rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pane { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); display: flex; flex-direction: column; height: 560px; box-shadow: var(--shadow-sm); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--color-text-muted); text-align: center; margin: auto; padding: 20px; }
.chat-bubble { max-width: 76%; padding: 10px 14px; border-radius: 14px; }
.chat-bubble.them { background: var(--color-surface-alt); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-bubble.me { background: var(--color-primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-who { font-size: .72rem; font-weight: 700; color: var(--color-accent-600); margin-bottom: 3px; }
.chat-body { font-size: .95rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-time { font-size: .66rem; opacity: .7; margin-top: 4px; text-align: right; }
.chat-input { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--color-border); }
.chat-input input { flex: 1; padding: 11px 14px; border: 1px solid var(--color-border); border-radius: 999px; font: inherit; outline: none; background: #fff; }
.chat-input input:focus { border-color: var(--color-primary-600); }
@media (max-width: 720px) { .chat-wrap.with-threads { grid-template-columns: 1fr; } .chat-threads { max-height: 200px; } }

/* ---- Tela de login ------------------------------------------------------- */
.login-body {
  min-height: 100vh; margin: 0;
  background:
    radial-gradient(1100px 600px at 80% -10%, #113a6b 0%, transparent 60%),
    var(--color-primary);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card { padding: 32px 30px 26px; }
.login-brand {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 11px; margin-bottom: 24px;
}
.login-emblem { border-radius: 15px; box-shadow: var(--shadow-md); }
.login-wordmark {
  font-family: var(--font-heading); font-weight: 800; font-size: 1.55rem;
  letter-spacing: -.02em; color: var(--color-primary); line-height: 1;
}
.login-wordmark .p2 { color: var(--color-accent-600); }
.login-cobrand {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 10px; background: var(--color-surface-alt);
  border: 1px solid var(--color-border); border-radius: 999px;
}
.login-cobrand img { display: block; }
.login-cobrand span {
  font-size: .68rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; text-align: center; }
.login-card > .hint { text-align: center; }

/* Documento legal (Política de Privacidade) */
.legal { line-height: 1.62; }
.legal h2 { font-size: 1.08rem; margin: 22px 0 8px; color: var(--color-primary); }
.legal h2:first-of-type { margin-top: 2px; }
.legal p, .legal li { color: var(--color-text); font-size: .95rem; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li { margin-bottom: 5px; }
.legal-meta { color: var(--color-text-muted); font-size: .85rem; }
.login-error { color: var(--color-hot); font-size: .85rem; font-weight: 600; min-height: 18px; margin: 4px 0; }
.login-demo {
  margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--color-border);
  display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: var(--color-text-muted);
}
.login-demo strong { color: var(--color-primary); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.login-demo code { background: var(--color-surface-alt); padding: 1px 6px; border-radius: 5px; font-size: .82em; }
.login-foot { text-align: center; color: rgba(255,255,255,.6); font-size: .78rem; margin-top: 18px; }
.signup-cta { text-align: center; font-size: .9rem; color: var(--color-text-muted); margin: 16px 0 0; }
.signup-cta a { font-weight: 700; }

/* ---- Cadastro de assessor (2 etapas) ------------------------------------ */
.signup-wrap { max-width: 480px; }
.checkbox-row {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  font-weight: 400; font-size: .86rem; color: var(--color-text-muted); line-height: 1.4;
}
.checkbox-row input { margin: 2px 0 0; width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--color-primary); }
.field.consent { margin-top: 6px; }
.field.consent > label { margin-bottom: 0; }
.signup-foot { border-top: 1px dashed var(--color-border); padding-top: 14px; margin-top: 20px; text-align: center; }

@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .panel { padding: 20px; }
  .site-header nav { gap: 14px; }
  .stepper .step span.txt { display: none; }
  .session-user { display: none; }   /* no mobile, mantém só o botão Sair */
  .ap-name, .brand-divider { display: none; } /* mobile: mantém só o selo AP */
}

/* ===== Fix: atributo [hidden] deve vencer o display dos componentes ===== */
[hidden] { display: none !important; }

/* ===== Painel de gestão (home) ===== */
.dash { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.dash-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 18px; }
.dash-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dash .panel { margin: 0; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.link-more { font-size: .82rem; font-weight: 700; color: var(--color-primary-600); text-decoration: none; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }

/* Counters compactos dentro do painel */
.dash .counters { margin-bottom: 0; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.dash .counter { padding: 12px 10px; }
.dash .counter .n { font-size: 1.5rem; }

/* Listas compactas (equipe, últimas propostas) */
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--color-border); }
.mini-row:last-child { border-bottom: none; }
.mini-main { min-width: 0; }
.mini-name { font-weight: 700; color: var(--color-primary); font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: .78rem; color: var(--color-text-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-val { font-weight: 800; color: var(--color-primary); font-size: .9rem; white-space: nowrap; }

/* Caixa do link de convite */
.invite-box { background: var(--color-surface-alt); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 12px; }
.invite-box .invite-label { font-size: .78rem; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.invite-row { display: flex; gap: 8px; }
.invite-row input { flex: 1; min-width: 0; font-size: .8rem; padding: 9px 10px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff;
  color: var(--color-primary); font-family: var(--font-body); }
.invite-hint { font-size: .76rem; color: var(--color-text-muted); margin: 8px 0 0; }
.invite-copied { color: #178a4c; font-weight: 700; }

/* Cartões de produto compactos no painel */
.card-grid.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.card-grid.compact .product-card { padding: 14px; }
.card-grid.compact .product-card p { display: none; }
.card-grid.compact .product-card .ico { width: 34px; height: 34px; }
.card-grid.compact .product-card h3 { font-size: 1rem; margin: 8px 0 6px; }

/* Bolha do assistente automático no chat */
.chat-bubble.them.bot .chat-who { color: var(--color-accent); }
.chat-bubble.them.bot { border-left: 3px solid var(--color-accent); }

@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; order: 2; }
  .dash-main { order: 1; }
}

/* Botões de tema do assistente no chat */
.chat-topics { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; margin-top: 2px; }
.chat-topic { background: #fff; border: 1.5px solid var(--color-primary); color: var(--color-primary);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: .88rem; cursor: pointer;
  font-family: var(--font-heading); transition: background .12s, color .12s; }
.chat-topic:hover { background: var(--color-primary); color: #fff; }

/* ===== White-label: marca do parceiro no header ===== */
.brand.wl { gap: 12px; align-items: center; }
.brand.wl .wl-logo { height: 46px; width: auto; max-width: 170px; border-radius: 8px;
  background: #fff; padding: 4px 6px; object-fit: contain; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.brand.wl .wl-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand.wl .wl-name { color: #fff; font-family: var(--font-heading); font-weight: 800;
  font-size: 1.15rem; letter-spacing: -.3px; }
.brand.wl .wl-seal { color: rgba(255,255,255,.62); font-size: .6rem; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; margin-top: 2px; }

/* ===== Swatches de cor (perfil / white-label) ===== */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .08s; }
.swatch:hover { transform: scale(1.08); }
.swatch.selected { box-shadow: 0 0 0 2px #fff inset, 0 0 0 3px var(--color-primary); }

/* ===== CRM / Kanban ===== */
.crm-toolbar { display:flex; gap:10px; align-items:center; margin-bottom:18px; }
.kanban { display:grid; grid-template-columns: repeat(4, 1fr); gap:14px; align-items:start; }
.kb-col { background: var(--color-surface-alt); border:1px solid var(--color-border); border-radius:12px; padding:10px; }
.kb-col-head { font-weight:800; color: var(--color-primary); font-size:.9rem; padding:4px 6px 10px; display:flex; justify-content:space-between; align-items:center; }
.kb-count { background: var(--color-primary); color:#fff; border-radius:999px; font-size:.72rem; padding:1px 8px; }
.kb-list { display:flex; flex-direction:column; gap:10px; min-height:40px; }
.kb-card { background:#fff; border:1px solid var(--color-border); border-radius:10px; padding:12px; box-shadow: var(--shadow-sm); }
.kb-name { font-weight:800; color: var(--color-primary); font-size:.95rem; }
.kb-sub { font-size:.78rem; color: var(--color-text-muted); margin-top:2px; word-break:break-word; }
.kb-money { font-size:.8rem; font-weight:700; color: var(--color-primary-600); margin-top:4px; }
.kb-tags { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.kb-tag { background: var(--color-surface-alt); border:1px solid var(--color-border); border-radius:999px; padding:2px 8px; font-size:.7rem; font-weight:700; color: var(--color-primary); }
.kb-actions { display:flex; align-items:center; gap:6px; margin-top:10px; }
.kb-move, .kb-edit, .kb-del { border:1px solid var(--color-border); background:#fff; border-radius:6px; cursor:pointer; font-family:var(--font-heading); font-weight:700; font-size:.75rem; padding:4px 8px; color: var(--color-primary); }
.kb-move { font-size:.9rem; padding:2px 9px; }
.kb-move[disabled] { opacity:.3; cursor:default; }
.kb-del { margin-left:auto; color:#b42318; border-color:#f3c9c4; }
.kb-move:hover:not([disabled]), .kb-edit:hover { background: var(--color-surface-alt); }
.kb-empty { color: var(--color-text-muted); text-align:center; padding:14px 0; font-size:.8rem; }
@media (max-width: 860px){ .kanban{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px){ .kanban{ grid-template-columns: 1fr; } }

/* ===== Menu na BARRA LATERAL esquerda (desktop) ===== */
@media (min-width: 861px) {
  .site-header {
    position: fixed; top: 0; left: 0; bottom: 0; width: 238px; z-index: 100;
    overflow-y: auto; box-shadow: 2px 0 16px rgba(16,32,56,.14);
  }
  .site-header .container {
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    min-height: 100%; gap: 6px; padding: 20px 14px; max-width: none;
  }
  .site-header .brand {
    padding: 2px 6px 14px; margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .site-header nav {
    flex-direction: column; align-items: stretch; gap: 3px; flex: 1 1 auto; flex-wrap: nowrap;
  }
  .site-header nav a {
    display: block; padding: 10px 12px; border-radius: 8px; font-size: .95rem;
  }
  .site-header nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .site-header nav a.active { background: rgba(246,167,35,.16); color: var(--color-accent); }

  /* "Mais" expandido inline (sem dropdown) */
  .site-header .nav-more { position: static; }
  .site-header .nav-more > summary { display: none; }
  .site-header .nav-more-menu {
    position: static; background: transparent; border: none; box-shadow: none;
    padding: 0; min-width: 0; margin-top: 3px;
  }
  .site-header .nav-more-menu a {
    color: rgba(255,255,255,.85) !important; padding: 10px 12px; font-size: .95rem; font-weight: 600;
  }
  .site-header .nav-more-menu a:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
  .site-header .nav-more-menu a.active { background: rgba(246,167,35,.16) !important; color: var(--color-accent) !important; }

  /* Área de sessão (nome + Sair) no rodapé da lateral */
  .site-header .session-area {
    margin-top: auto; flex-direction: column; align-items: stretch; gap: 8px;
    padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12);
  }
  .site-header .session-user { display: block !important; font-size: .84rem; }
  .site-header .session-logout { width: 100%; }

  /* Conteúdo deslocado para a direita da lateral */
  main, .site-footer { margin-left: 238px; }
}

/* ===== Barra lateral no azul Advisor Partners (estilo da apresentação) ===== */
@media (min-width: 861px) {
  /* Azul profundo com brilho no topo (como a capa da apresentação).
     Usa a cor primária (respeita o white-label do parceiro). */
  .site-header {
    background:
      radial-gradient(155% 50% at 50% -6%,
        color-mix(in srgb, var(--color-primary) 30%, #57abf0) 0%,
        color-mix(in srgb, var(--color-primary) 70%, #2f83cf) 34%,
        transparent 70%),
      linear-gradient(180deg,
        var(--color-primary) 0%,
        color-mix(in srgb, var(--color-primary) 72%, #000) 100%);
  }

  /* Logomarca Advisor Partners em destaque no topo da lateral
     (chaves douradas + "ADVISOR PARTNERS"; "Advisor P2" como sub-marca) */
  .site-header .brand { flex-direction: column; align-items: flex-start; gap: 8px; }
  .site-header .brand .brand-divider { display: none; }
  .site-header .brand .ap-lockup { order: 1; gap: 11px; align-items: center; }
  .site-header .brand .ap-keys { width: 44px; height: 46px; }
  .site-header .brand .ap-name {
    font-size: .82rem; line-height: 1.08; letter-spacing: .14em;
    font-weight: 800; color: #fff; text-transform: uppercase;
  }
  .site-header .brand .wordmark {
    order: 2; font-size: .92rem; font-weight: 700;
    color: rgba(255,255,255,.62); letter-spacing: .01em;
  }
}

/* Botão "subir logo do escritório" no topo da barra lateral (só advisor, desktop) */
.wl-logo-upload { display: none; }
@media (min-width: 861px) {
  .site-header .wl-logo-upload { display: block; margin: -2px 0 10px; }
  .wl-logo-btn { display: block; text-align: center; cursor: pointer; font-size: .78rem; font-weight: 700;
    color: rgba(255,255,255,.85); background: rgba(255,255,255,.08);
    border: 1px dashed rgba(255,255,255,.30); border-radius: 8px; padding: 8px 10px;
    transition: background .12s, border-color .12s; }
  .wl-logo-btn:hover { background: rgba(255,255,255,.15); border-color: rgba(246,167,35,.55); color: #fff; }
}
