:root {
  color-scheme: light;
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--brand-ink);
  background: var(--brand-surface);
  --muted: #555f77;
  --line: var(--brand-line);
  --accent: var(--brand-indigo);
  --accent-soft: var(--brand-indigo-soft);
  --white: var(--brand-white);
  --text: var(--brand-ink);
  --surface: var(--brand-surface);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --focus: var(--brand-focus);
  --shadow: 0 16px 56px #24203e26;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: var(--nav-width, 240px) minmax(0, 1fr); }
main { min-width: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
body.overlay-active { overflow: hidden; }

.sidebar { background: var(--white); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto; }
.sidebar-top { display: flex; align-items: center; min-height: 44px; }
.sidebar .nav-toggle { width: 44px; height: 44px; align-self: flex-end; display: grid; place-items: center; flex-shrink: 0; }
#menu-close, .company-compact { display: none; }
.line-icon, .line-icon svg { display: block; width: 22px; height: 22px; }
.workspace { padding: 16px 0; border-block: 1px solid var(--line); }
.workspace select { min-height: 44px; }
.company-picker { position: fixed; inset: auto; margin: 0; width: min(320px, calc(100vw - 32px)); max-height: 70dvh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); background: var(--white); color: var(--text); }
.company-picker h2 { font-size: 14px; margin-bottom: 12px; }
#company-options { display: grid; gap: 6px; }
.company-option { min-height: 48px; padding: 12px; text-align: left; border: 1px solid transparent; border-radius: 8px; background: var(--surface); overflow-wrap: anywhere; }
.company-option[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 700; }
.nav-tooltip { position: fixed; inset: auto; margin: 0; padding: 8px 12px; border: 0; border-radius: 8px; background: var(--brand-ink); color: white; box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 5px; font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -.6px; min-width: 0; }
.brand div span { color: var(--brand-ink); }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; }
/* O ícone reaproveita o arquivo da marca (brand/orga-symbol.svg). No menu recolhido, o texto é
   ocultado e sobra apenas o símbolo. */
.brand-icon { display: block; width: 42px; height: 28px; flex: 0 0 42px; }
.workspace label { display: block; padding: 0 2px; margin-bottom: 6px; font-size: 10px; font-weight: 750; letter-spacing: .12em; color: var(--muted); }
.workspace select { width: 100%; padding: 9px 10px; font-weight: 650; }
nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); padding: 12px; text-align: left; font-weight: 600; font-size: 13px; }
.nav-icon { display: grid; place-items: center; width: 24px; flex: 0 0 24px; }
.nav-item:hover { background: var(--accent-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before { content: ""; position: absolute; width: 3px; height: 20px; border-radius: 3px; left: 0; top: calc(50% - 10px); background: var(--accent); }
.sidebar-footer { margin-top: auto; padding: 12px 5px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.demo-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b56f12; margin-right: 5px; }
.mode-exit { display: block; margin-top: 8px; padding: 0; color: var(--accent); background: none; border: 0; font-size: 12px; text-align: left; }
.nav-backdrop { position: fixed; inset: 0; background: #20244480; z-index: 15; }
.menu-button { display: none; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); font-weight: 700; font-size: 13px; }

/* Recolher a navegação devolve a largura ao conteúdo: a variável é consumida pelo grid do body.
   Vale só no computador; no celular a navegação é uma gaveta sobreposta e sempre mostra os rótulos. */
@media (min-width: 901px) {
  body.nav-collapsed { --nav-width: 72px; }
  body.nav-collapsed .sidebar { padding: 24px 12px; align-items: center; gap: 16px; }
  body.nav-collapsed .brand div,
  body.nav-collapsed .workspace label,
  body.nav-collapsed .nav-text,
  body.nav-collapsed .sidebar-footer,
  body.nav-collapsed .workspace select { display: none; }
  body.nav-collapsed .sidebar-top { justify-content: center; }
  body.nav-collapsed .nav-toggle { align-self: center; }
  body.nav-collapsed .brand { padding: 0; justify-content: center; }
  body.nav-collapsed .workspace { width: 48px; padding: 16px 0; }
  body.nav-collapsed .company-compact { display: grid; place-items: center; width: 44px; height: 44px; margin: auto; border: 1px solid var(--brand-indigo-line); border-radius: var(--radius); background: var(--white); color: var(--accent); font-size: 13px; font-weight: 750; }
  body.nav-collapsed .nav-item { justify-content: center; padding: 12px; width: 48px; height: 48px; }
}
.access { grid-column: 1 / -1; display: grid; place-items: center; padding: 24px; min-height: 100vh; }
.access-card { width: min(100%, 410px); background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 12px 40px #1b234212; }
.access-card .brand { padding: 0; margin-bottom: 28px; }
.access-card h1 { font-size: 28px; }
.access-card p { color: var(--muted); }
.access-card form { display: grid; gap: 12px; }
.access-card label { font-size: 13px; font-weight: 700; }
.access-card input { display: block; width: 100%; margin-top: 5px; }
.access-card #enter-demo { width: 100%; margin-top: 12px; }
.access-card .form-error { margin: 0; color: #a02d40; }

.topbar { position: sticky; top: 0; z-index: 5; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 2vw, 32px); border-bottom: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 12px; }
.topbar b { margin: 0 6px; color: #777f91; }
.topbar strong { color: #26304b; }
.local-tag { border: 1px solid var(--line); padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.content { padding: 28px clamp(16px, 2vw, 32px) 24px; max-width: 1700px; margin: auto; }
.heading, .board-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.heading { margin-bottom: 26px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; margin: 0 0 5px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(26px, 2.5vw, 32px); letter-spacing: -.035em; }
h2 { font-size: 18px; letter-spacing: -.025em; }
.heading p:last-child { margin: 9px 0 0; color: var(--muted); }
.primary, .secondary { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 650; white-space: normal; text-decoration: none; font-size: 13px; }
.primary { border: 1px solid var(--accent); background: var(--accent); color: var(--white); }
.primary:hover { background: var(--brand-indigo-strong); }
.secondary { border: 1px solid var(--line); background: var(--white); }
.secondary:hover { background: var(--accent-soft); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 30px; }
.stat { min-width: 0; display: grid; align-content: start; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 16px; font-weight: 750; margin-bottom: 5px; }
.stat-label { font-size: 12px; font-weight: 650; color: var(--muted); }
.stat-value { font-size: clamp(19px, 2.15vw, 28px); letter-spacing: -.045em; overflow-wrap: anywhere; line-height: 1.2; }
.stat small { font-size: 11px; color: var(--muted); }

.board-header { margin-bottom: 14px; }
.board-title { display: grid; gap: 4px; max-width: 780px; }
.board-title h2 { font-size: 17px; }
.board-subtitle { margin: 0; color: var(--muted); font-size: 12px; }
.board-subtitle b { color: #26304b; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea { border: 1px solid #d6dbe8; border-radius: 8px; padding: 8px 9px; background: var(--white); color: var(--brand-ink); min-width: 0; }
input::placeholder, textarea::placeholder { color: #667087; }
input:disabled { background: #f0f1f5; }
/* Faixa única para filtros rápidos, busca, origem e ordenação; em tela estreita ela quebra sem cortar. */
.board-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-group-label { font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.filter-group--fields { margin-left: auto; }
.board-controls input, .board-controls select { font-size: 13px; }
.board-controls #search { width: 230px; max-width: 100%; }
.filter-chip { border: 1px solid var(--line); background: var(--white); color: var(--muted); border-radius: 20px; padding: 8px 13px; font-size: 13px; font-weight: 650; }
.filter-chip:hover { background: var(--accent-soft); }
.filter-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.filter-hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.filter-hint b { color: #26304b; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 13px; }
.active-filter { background: var(--accent-soft); color: var(--accent); border-radius: 20px; padding: 4px 11px; font-size: 12px; font-weight: 650; }
.clear-filters { font-size: 12px; padding: 5px 11px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(176px, 1fr)); gap: 12px; overflow-x: auto; padding: 3px 3px 12px; margin: -3px -3px 0; }
.column { --stage: #5970c5; --stage-soft: #eef1fa; --stage-ink: #33417a; display: flex; flex-direction: column; gap: 9px; background: var(--stage-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 190px; }
.column[data-stage="contact"] { --stage: #ab6c14; --stage-soft: #fbf1dd; --stage-ink: #7a4c07; }
.column[data-stage="proposal"] { --stage: #7a50bc; --stage-soft: #f2ecfb; --stage-ink: #5b3795; }
.column[data-stage="won"] { --stage: var(--brand-success); --stage-soft: var(--brand-success-soft); --stage-ink: var(--brand-success-ink); }
.column[data-stage="lost"] { --stage: #a04765; --stage-soft: #fbeef1; --stage-ink: #7f3350; }
.column.drop-target { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.column-header { display: flex; align-items: center; gap: 7px; padding: 2px 2px 9px; border-bottom: 2px solid var(--stage); }
.column-header h3 { font-size: 12px; color: var(--stage-ink); overflow-wrap: anywhere; }
.stage-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 3px; background: var(--stage); }
.count { margin-left: auto; background: var(--white); border: 1px solid var(--stage); border-radius: 12px; padding: 1px 7px; color: var(--stage-ink); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.card-wrap { border: 1px solid #dfe3ed; border-radius: 10px; background: var(--white); box-shadow: 0 1px 2px #1b23420a; }
.card-wrap:hover { border-color: #958af0; }
.card-wrap.dragging { opacity: .45; }
.contact-card { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; width: 100%; border: 0; border-radius: 10px 10px 0 0; padding: 10px; background: transparent; }
.contact-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; width: 100%; }
.contact-head strong { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.3; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; background: #edeefa; color: #494390; font-weight: 750; font-size: 10px; }
.source-pill { display: inline-block; border-radius: 6px; padding: 2px 7px; background: #eff1f6; color: #43506a; font-size: 10px; font-weight: 700; white-space: nowrap; }
.source-pill.meta { color: var(--accent); background: var(--accent-soft); }
.card-secondary { display: grid; gap: 3px; width: 100%; min-width: 0; }
.campaign { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.card-activity { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.card-sale { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; width: 100%; }
.sale-value { color: var(--brand-success); font-weight: 750; font-size: 13px; }
.card-meta { max-width: 100%; color: var(--muted); font-size: 10px; }
.card-lost { color: #8c3f5b; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
/* Próxima ação no cartão: a cor, o rótulo e a data dizem juntos se está atrasada, para hoje ou agendada. */
.next-chip { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 5px; max-width: 100%; width: 100%; border-radius: 7px; padding: 4px 8px; font-size: 11px; font-weight: 650; background: var(--surface); border: 1px solid var(--line); color: #3d4661; overflow-wrap: anywhere; }
.next-chip .next-when { font-weight: 750; white-space: nowrap; }
.next-chip .next-text { color: inherit; }
.next-chip.overdue { background: #fdeef1; border-color: #e9bccb; color: #8f2843; }
.next-chip.today { background: #fdf3e0; border-color: #e6cfa3; color: #7a5410; }
.next-chip.scheduled { background: #e9f1fb; border-color: #bed5f0; color: #2b547f; }
.card-move { display: block; min-height: 44px; width: calc(100% - 20px); margin: 0 10px 10px; padding: 8px; font-size: 12px; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 8px; }
.card-move:hover { color: var(--accent); border-color: var(--brand-indigo-line); }
.card-conversation { display: block; min-height: 44px; width: calc(100% - 20px); margin: 0 10px 2px; padding: 8px; font-size: 12px; font-weight: 600; text-align: left; color: var(--muted); background: transparent; border: 0; border-radius: 8px; }
.card-conversation:hover { color: var(--accent); background: var(--accent-soft); }
.rate-mark { display: inline-block; border-radius: 5px; padding: 2px 7px; background: #eff1f6; color: #43506a; font-size: 11px; font-weight: 700; }
.rate-mark.counted { color: #8c3f5b; background: #f9e9ef; }
.event-reason { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.empty { color: var(--muted); font-size: 12px; margin: 3px 0; padding: 9px; border: 1px dashed #c9cedd; border-radius: 7px; }
.board-empty { grid-column: 1 / -1; display: grid; justify-items: start; gap: 11px; padding: 22px; border: 1px dashed #c9cedd; border-radius: 11px; background: var(--white); color: var(--muted); }
.board-empty p { margin: 0; font-size: 13px; }

.sales-summary { margin-top: 24px; padding: 24px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.sales-summary:first-child { margin-top: 0; }
.sales-summary-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sales-summary-hint { margin: 6px 0 12px; color: var(--muted); font-size: 12px; }
.badge { border: 1px solid var(--line); background: var(--white); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; color: var(--muted); }

.report-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.report-period { display: flex; flex-wrap: wrap; gap: 8px; }
.report-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.report-custom label { font-size: 11px; font-weight: 700; color: var(--muted); }
.report-custom input { display: block; margin-top: 3px; font-size: 13px; }
.report-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.report-kpi { min-width: 0; display: grid; align-content: start; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.report-note { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: #fdf3e0; border: 1px solid #e6cfa3; color: #7a5410; font-size: 12px; }
.origin-link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-align: left; }
.origin-link:hover { text-decoration: underline; }
.origin-link[aria-pressed="true"] { text-decoration: underline; }
.audiences-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 13px; }
.audiences-note { margin: 0; color: var(--muted); font-size: 12px; }
.audiences-actions + .audiences-note { margin-top: 8px; }
.report-list { margin-top: 22px; }
.report-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.report-list-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Layout de Conversas definido pelo espaço real do painel (#inbox), não pela largura da janela:
   lista + histórico aparecem juntos; a ficha vira painel sob demanda quando não há espaço para três. */
.view-conversations .heading { margin-bottom: 20px; }
.view-conversations .heading .eyebrow { display: none; }
.view-conversations .main-footer { display: none; }
.inbox { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; height: var(--inbox-height, 65dvh); min-height: 240px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--white); overflow: hidden; }
.inbox.inbox--medium { grid-template-columns: 240px minmax(0, 1fr); }
.inbox.inbox--wide { grid-template-columns: 240px minmax(0, 1fr) 260px; }
.inbox-list, .inbox-thread, .inbox-contact { min-width: 0; min-height: 0; background: var(--white); padding: 16px; }
.inbox-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.inbox-list-head { display: grid; gap: 12px; margin-bottom: 16px; flex-shrink: 0; }
.inbox-list-head h2 { font-size: 15px; }
.inbox-list-head input { width: 100%; font-size: 13px; }
.inbox-list-head .filter-hint { margin: 0; }
.conversation-list { display: grid; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; padding: 3px; margin: -3px; }
.conversation-item { display: grid; gap: 6px; width: 100%; min-height: 74px; text-align: left; border: 1px solid transparent; border-left: 3px solid transparent; border-radius: 9px; background: white; padding: 12px 10px; }
.conversation-item:hover { background: #f0f1f8; }
.conversation-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.conversation-head { display: flex; align-items: baseline; gap: 8px; }
.conversation-head strong { min-width: 0; overflow-wrap: break-word; white-space: normal; font-size: 13px; }
.conversation-head { flex-wrap: wrap; }
.conversation-time { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.conversation-preview { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* O histórico ocupa a altura disponível e rola por dentro; o campo de resposta fica sempre visível. */
.inbox-thread { display: flex; flex-direction: column; padding: 0; background: #fafafd; }
.inbox-thread > .empty { margin: 0; }
.thread { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.thread-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 16px; background: white; flex-shrink: 0; }
.thread-title { flex: 1 1 130px; min-width: 0; display: grid; }
.thread-title strong { font-size: 15px; overflow-wrap: break-word; }
.thread-title small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.thread-back { display: none; flex: 0 0 auto; }
.thread-details { flex: 0 0 auto; }
.thread-head > a { flex: 0 0 auto; font-size: 12px; text-decoration: none; }
.thread-messages { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; overflow-y: auto; overscroll-behavior: contain; padding: 24px 20px; }
.bubble { min-width: 0; max-width: min(85%, 520px); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; line-height: 1.55; overflow-wrap: break-word; word-break: normal; }
.bubble > span:first-child { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { justify-self: start; background: white; border: 1px solid var(--line); }
.bubble.out { justify-self: end; background: var(--accent-soft); }
.bubble-meta { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; overflow-wrap: normal; }
.bubble-photo { border: 0; padding: 0; background: none; display: block; max-width: 100%; cursor: zoom-in; }
.bubble-photo img { display: block; width: 240px; max-width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); }
.thread-reply { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; border-top: 1px solid var(--line); padding: 16px 16px 8px; background: white; }
.thread-reply textarea { width: 100%; min-height: 64px; max-height: 120px; resize: none; font-size: 16px; }
.thread-reply button { justify-self: end; }
.thread-state { flex-shrink: 0; margin: 0; padding: 4px 16px 12px; color: var(--muted); background: white; font-size: 11px; }
.thread-state.send-error { color: #a02d40; }
/* A ficha é coluna fixa só na largura ampla; nas demais ela abre sob demanda pelo botão Detalhes. */
.inbox-contact { display: none; flex-direction: column; border-left: 1px solid var(--line); padding: 0; overflow: hidden; }
.inbox-contact-head { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 16px; background: white; }
.inbox-contact-label { font-size: 12px; font-weight: 750; color: var(--muted); }
.inbox--wide .inbox-contact { display: flex; }
.inbox--wide .contact-close { display: none; }
#inbox-contact-body { overflow-y: auto; padding: 20px 16px; min-height: 0; overscroll-behavior: contain; }
.contact-identity { display: grid; justify-items: start; gap: 10px; margin-bottom: 24px; }
.contact-identity h3 { font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.contact-avatar { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }
.stage-badge { border-radius: 6px; background: var(--accent-soft); color: var(--accent); padding: 4px 8px; font-size: 11px; font-weight: 700; }
.stage-won { background: var(--brand-success-soft); color: var(--brand-success-ink); }
.stage-lost { background: #fbeef1; color: #933c53; }
.contact-group { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 20px; }
.contact-group h4 { margin: 0 0 12px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.inbox-contact dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; margin: 0; font-size: 13px; }
.inbox-contact dt { color: var(--muted); font-weight: 650; }
.inbox-contact dd { margin: 0 0 12px; overflow-wrap: anywhere; }
.inbox-contact-actions { display: grid; gap: 8px; }
.contact-overlay { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; width: min(380px, 90vw); height: 100dvh; max-height: 100dvh; max-width: 100vw; border: 0; border-radius: 16px 0 0 16px; box-shadow: var(--shadow); }
.contact-overlay::backdrop { background: #20213966; }
.contact-overlay[open] { display: flex; }
.contact-overlay .inbox-contact { display: flex; width: 100%; height: 100%; border: 0; }
.contact-overlay.bottom-sheet { inset: auto 0 0; width: 100%; height: min(78dvh, 650px); max-height: 90dvh; border-radius: 20px 20px 0 0; }
.contact-overlay.bottom-sheet #inbox-contact-body { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.contact-overlay .inbox-contact-head { padding: 16px 20px; }
/* Tela estreita: uma coluna só; Voltar alterna entre lista e conversa. */
.inbox--narrow:not(.thread-open) .inbox-thread { display: none; }
.inbox--narrow.thread-open .inbox-list { display: none; }
.inbox--narrow .thread-back { display: inline-flex; }
.inbox--narrow .thread-head { padding: 12px; }
.inbox--narrow .thread-title { flex-basis: calc(100% - 110px); }
.inbox--narrow .thread-details, .inbox--narrow #thread-whatsapp { font-size: 12px; }
.inbox--narrow .thread-reply { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 4px; gap: 8px; }
.inbox--narrow .thread-messages { padding: 16px 12px; }
.inbox--narrow .bubble { max-width: 92%; }
.inbox--narrow .thread-state { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.reason-pill { display: inline-block; border-radius: 5px; padding: 2px 6px; background: #fdeef1; color: #8f2843; font-size: 10px; font-weight: 700; }
/* A caixa de autorização usa grade própria para o rótulo quebrar em linhas sem esticar o checkbox.
   Fica fora do .form-grid para não herdar as regras genéricas de largura dos campos. */
.consent-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 650; cursor: pointer; }
.consent-row:hover { border-color: var(--brand-indigo-line); }
.consent-row input { width: 20px; height: 20px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.consent-text { display: block; min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.photo-dialog { width: min(720px, calc(100% - 24px)); }
.photo-dialog img { display: block; width: 100%; height: auto; border-radius: 9px; }
.lost-options { display: grid; gap: 7px; margin: 0 0 12px; padding: 0; border: 0; }
.lost-options label { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 13px; font-weight: 650; cursor: pointer; }
.lost-options label:hover { background: var(--accent-soft); }
.lost-options input { margin: 0; }
.dialog-hint { margin: 0 0 10px; color: var(--muted); font-size: 12px; }

.event-note { padding: 14px; background: var(--accent-soft); color: var(--brand-ink); border-radius: 9px; margin: 0 0 14px; }
.event-note p { margin: 4px 0 0; }
.event-table-wrap { overflow: auto; border: 1px solid var(--line); background: var(--white); border-radius: 10px; }
.events-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.events-table th, .events-table td { padding: 13px; text-align: left; border-bottom: 1px solid var(--line); }
.events-table th { background: #f0f2f8; white-space: nowrap; }
.events-table tr:last-child td { border-bottom: 0; }
.main-footer { margin-top: 22px; color: var(--muted); font-size: 11px; }
.main-footer span { margin: 0 4px; }

dialog { border: 1px solid var(--line); border-radius: 15px; padding: 21px; width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); color: var(--brand-ink); box-shadow: 0 16px 80px #14132c55; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #20244480; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.dialog-heading { margin-bottom: 14px; }
.icon-button { font-size: 23px; width: 44px; height: 44px; line-height: 1; background: #f2f3f8; border-radius: 8px; border: 0; }
/* A ficha limita a altura à área visível: só o corpo rola, as ações ficam sempre alcançáveis. */
#lead-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 16px; padding-right: 4px; margin-right: -4px; }
.form-section { display: grid; gap: 11px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 16px; }
.form-section h3 { font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-grid label { font-size: 12px; font-weight: 700; min-width: 0; }
/* Campos de texto ocupam a linha inteira; o checkbox fica de fora para não ser esticado pela regra. */
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea { display: block; width: 100%; margin-top: 4px; font-size: 16px; font-weight: 400; }
.form-grid textarea { resize: vertical; }
.wide { grid-column: 1 / -1; }
.next-action-state { margin: 0; color: var(--muted); font-size: 12px; }
.next-action-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.next-action-actions button { font-size: 12px; padding: 7px 12px; min-height: 40px; }
.form-error { font-size: 13px; color: #a02d40; }
.message-panel { margin-top: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #f7f8fc; }
.message-panel label { display: block; font-size: 13px; font-weight: 700; }
.message-panel textarea { display: block; width: 100%; margin-top: 5px; resize: vertical; }
.message-panel p { margin: 8px 0; color: var(--muted); font-size: 12px; }
.template-panel, .template-item { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.template-panel { max-width: 640px; margin-bottom: 24px; }
.template-panel > button { margin-top: 14px; white-space: normal; }
.template-list { display: grid; gap: 9px; max-width: 640px; margin-top: 12px; }
.template-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; font-size: 13px; }
.template-item button { margin-left: auto; white-space: normal; }
.primary:disabled, .secondary:disabled { opacity: .55; cursor: wait; }
.dialog-actions { justify-content: flex-end; flex-wrap: wrap; margin-top: 17px; }
.dialog-actions a { color: var(--accent); font-weight: 700; font-size: 13px; margin-right: auto; }
#toast:not(:empty) { position: fixed; bottom: 14px; right: 14px; max-width: calc(100% - 28px); padding: 10px 14px; border-radius: 8px; background: #24304d; color: var(--white); font-size: 13px; }

/* Visão geral: resumo da empresa com indicadores, lista Hoje e primeiros passos. */
.overview-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.shortcut-button { min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--accent); font-size: 13px; font-weight: 650; }
.shortcut-button:hover { background: var(--accent-soft); border-color: var(--brand-indigo-line); }
.overview-stats { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.stat-button { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.stat-button:hover { border-color: var(--brand-indigo-line); box-shadow: 0 8px 22px #24203e1a; }
.overview-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.overview-panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.overview-panel h2 { font-size: 16px; margin: 0; }
.overview-panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.overview-lead { color: var(--muted); font-size: 12px; margin: 8px 0 14px; }
.today-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.today-list { display: grid; gap: 10px; }
.today-item { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.today-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.today-head .next-chip { width: auto; flex: 0 0 auto; }
.today-action { font-size: 13px; }
.today-meta { color: var(--muted); font-size: 11.5px; }
.today-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.today-actions button { min-height: 36px; padding: 7px 12px; font-size: 12.5px; }
.overview-empty { display: grid; justify-items: start; gap: 8px; padding: 14px; border: 1px dashed #c9cedd; border-radius: 10px; }
.overview-empty-hint { color: var(--muted); font-size: 12px; }
.first-steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.first-step { display: flex; align-items: flex-start; gap: 10px; }
.step-mark { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 12px; font-weight: 750; }
.first-step.done .step-mark { background: var(--brand-success-soft); border-color: var(--brand-success-line); color: var(--brand-success-ink); }
.step-body { display: grid; gap: 2px; }
.step-body strong { font-size: 13px; }
.step-body span { color: var(--muted); font-size: 12px; }

/* Entrada por convite ou solicitação: links discretos abaixo do login, com avisos curtos. */
.access-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.link-button { border: 0; background: none; padding: 2px 0; color: var(--accent); font-size: 13px; font-weight: 650; text-align: left; }
.link-button:hover { text-decoration: underline; }
.access-back { margin-bottom: 4px; }
.access-hint { margin: 0; color: var(--muted); font-size: 12px; }
.form-ok { margin: 0; color: var(--brand-success); font-size: 13px; }
.access-card .form-ok { color: var(--brand-success); }

/* Painéis administrativos (Equipe e Painel Trovare) compartilham a mesma base visual.
   O corpo do painel Trovare já é a moldura, então .master-panel só organiza o conteúdo. */
.admin-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.admin-panel + .admin-panel { margin-top: 20px; }
.admin-panel > * + * { margin-top: 16px; }
.master-panel { display: grid; gap: 16px; }
.campaign-editor { max-width: 40rem; gap: 12px; }
.campaign-editor label { display: grid; gap: 4px; min-width: 0; }
.campaign-editor input, .campaign-editor select, .campaign-editor button,
#campaign-field select, #campaign-export { min-height: 44px; }
.campaign-editor button { justify-self: start; }
#campaign-performance th { white-space: normal; min-width: 100px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-head { display: grid; gap: 6px; }
.admin-head h2 { font-size: 17px; }
.panel-hint { margin: 0; color: var(--muted); font-size: 12px; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.admin-row--stack { align-items: flex-start; flex-direction: column; }
.admin-main { flex: 1 1 240px; min-width: 0; display: grid; gap: 4px; }
.admin-main strong { font-size: 14px; overflow-wrap: anywhere; }
.admin-sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; border: 1px solid var(--line); background: var(--white); color: var(--muted); border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag-ok { background: var(--brand-success-soft); border-color: var(--brand-success-line); color: var(--brand-success-ink); }
.tag-warn { background: #fdf3e0; border-color: #e6cfa3; color: #7a5410; }
.tag-muted { background: #f0f1f5; }
.admin-note { margin: 0; color: #26304b; font-size: 12.5px; overflow-wrap: anywhere; }
.admin-select { min-width: 150px; font-size: 13px; }
.admin-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-controls--form { align-items: flex-end; }
.admin-controls label { display: grid; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.admin-controls input, .admin-controls select { font-size: 13px; min-height: 38px; }
.admin-controls #master-search { width: 260px; max-width: 100%; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form label { display: grid; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.inline-form input, .inline-form select { font-size: 13px; min-height: 38px; }

/* Convite: bloco com o código copiável, usado tanto na Equipe quanto no Painel Trovare. */
.master-notice { background: var(--accent-soft); border: 1px solid var(--brand-indigo-line); border-radius: var(--radius-lg); padding: 18px; }
.master-notice > * + * { margin-top: 14px; }
.master-notice .admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.invite-result { margin-top: 16px; }
.invite-result-card { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.master-notice .invite-result-card { background: var(--white); }
.invite-line { margin: 0; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.invite-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.invite-code { flex: 1 1 200px; min-width: 0; padding: 10px 12px; border: 1px dashed var(--brand-indigo-line); border-radius: 8px; background: var(--white); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; letter-spacing: .04em; overflow-wrap: anywhere; }
.invite-hint { margin: 0; color: var(--muted); font-size: 12px; }

/* Editor da home pública: campos estruturados, prévia somente leitura e ações de rascunho/publicação. */
.home-form { display: grid; gap: 14px; max-width: 720px; }
.home-form > label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.home-form input, .home-form textarea, .home-form select { width: 100%; font-size: 13px; font-weight: 400; }
.home-form textarea { resize: vertical; }
.home-faq-section { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.faq-editor { display: grid; gap: 12px; }
.faq-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.faq-row label { display: grid; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.faq-row input, .faq-row textarea { width: 100%; font-size: 13px; font-weight: 400; }
.faq-row textarea { resize: vertical; }
.home-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.home-preview-body { display: grid; gap: 10px; }
.preview-eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.preview-title { font-size: 20px; }
.preview-subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-cta { border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; background: var(--white); font-size: 12px; font-weight: 650; }
.preview-faq { display: grid; gap: 6px; }
.preview-heading { font-size: 12px; }
.preview-footer { margin: 0; color: var(--muted); font-size: 12px; }

/* Responsável no cartão do funil: pendência visível para quem distribui os contatos. */
.card-assignee { color: #3d4661; font-weight: 650; }
.card-assignee.unassigned { color: #8f2843; font-weight: 700; }
.assignee-filter { border-style: dashed; }

/* Celular/tablet estreito: a navegação vira gaveta sobreposta, aberta pelo botão Menu. */
/* Duas colunas na ficha só quando há largura; abaixo disso, uma coluna. */
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .overview-columns { grid-template-columns: minmax(0, 1fr); }
  body { display: block; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-button { display: inline-flex; }
  .nav-toggle { display: none; }
  .sidebar .nav-toggle { display: none; }
  #menu-close { display: inline-flex; align-self: flex-end; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(290px, 84vw); height: 100vh; align-self: auto; border-right: 1px solid var(--line); transform: translateX(-100%); transition: transform .2s ease; z-index: 20; }
  body.nav-open .sidebar { transform: none; }
  .sidebar { height: 100dvh; }
  .menu-button { min-height: 44px; }
}
@media (max-width: 640px) {
  .content { padding-top: 22px; }
  .view-conversations .content { padding: 16px 12px; }
  .view-conversations .heading { margin-bottom: 16px; }
  .view-conversations .heading p:last-child { display: none; }
  .topbar-path { font-size: 11px; }
  .topbar-path b { margin: 0 2px; }
  .topbar .local-tag { display: none; }
  .sales-summary { padding: 16px; }
  .heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .board-controls { padding: 10px; }
  .filter-group { width: 100%; }
  .filter-group--fields { margin-left: 0; }
  .board-controls #search { flex: 1 1 190px; width: auto; }
  .board-controls .filter-chip { flex: 1 1 auto; text-align: center; }
  .report-kpis { grid-template-columns: 1fr; }
  .report-controls, .report-custom, .report-list-head, .report-list-actions { width: 100%; }
  .board { grid-template-columns: repeat(5, minmax(178px, 74vw)); }
  .inbox-list, .inbox-thread, .inbox-contact { max-width: 100%; }
  .bubble-photo img { width: min(170px, 100%); }
  .admin-panel, .master-notice { padding: 16px; }
  .admin-controls, .inline-form { align-items: stretch; }
  .admin-controls label, .inline-form label, .admin-controls input, .inline-form input, .inline-form select, .admin-controls #master-search { width: 100%; }
  .admin-row { align-items: stretch; }
  .admin-row .primary, .admin-row .secondary { width: 100%; }
  .faq-row { grid-template-columns: minmax(0, 1fr); }
  .faq-row .icon-button { justify-self: end; }
}
