/* ================================================================
   CRM Imobiliária — estilos (layout fluido estilo iOS)
   As cores da marca chegam do painel (Configurações > Empresa e
   marca) como variáveis CSS geradas em src/brand.php. Aqui ficam
   só as cores que não dependem da marca e a estrutura.
   ================================================================ */
:root {
  --danger: #B0412C; --danger-soft: #F8E3DD;
  --ok: #3F6B1E; --ok-soft: #E3EDD2;
  --cold: #2F5776; --cold-soft: #DFE9F2;
  --hot: #A23A1F; --hot-soft: #F8DFD5;
  --wa: #1D7A4C; --wa-hover: #155E3A;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --side-w: 256px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --danger: #EE9078; --danger-soft: #3B1F17; --ok: #A9CF84; --ok-soft: #1F2D12;
    --cold: #A3C4E2; --cold-soft: #1B2A37; --hot: #F3A58C; --hot-soft: #3C2017; --wa: #2B9A62; --wa-hover: #33B271;
  }
}
:root[data-theme="dark"] {
  --danger: #EE9078; --danger-soft: #3B1F17; --ok: #A9CF84; --ok-soft: #1F2D12;
  --cold: #A3C4E2; --cold-soft: #1B2A37; --hot: #F3A58C; --hot-soft: #3C2017; --wa: #2B9A62; --wa-hover: #33B271;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--fg); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 2.05rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
code { background: var(--fill); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.icon { flex: none; vertical-align: -0.2em; }
.logo-l { display: var(--logo-light); }
.logo-d { display: var(--logo-dark); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.danger { color: var(--danger) !important; }
.mt { margin-top: 22px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; }
[hidden] { display: none !important; }

/* ---------------- Estrutura ---------------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.topbar, .nav-toggle, .nav-backdrop, .tabbar, .sheet-grip { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; padding: 22px 14px 14px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--glass-line);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 2px 10px 4px; text-decoration: none; color: var(--fg); }
.brand:hover { color: var(--fg); }
.brand-img.brand-side { height: 44px; width: auto; max-width: 200px; object-fit: contain; object-position: left center; }
.brand-img.brand-top { height: 30px; width: auto; max-width: 52vw; object-fit: contain; }
.brand-img.brand-login { height: 64px; width: auto; max-width: 260px; object-fit: contain; }
.brand-text { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; line-height: 1.15; }
.brand small { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding-left: 2px; }
.quick-add { margin: 2px 0; }

.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a {
  display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: 11px;
  color: var(--fg-2); text-decoration: none; font-weight: 600; transition: background 0.2s var(--ease), color 0.2s;
}
.menu a span { flex: 1; }
.menu a:hover { background: var(--fill); color: var(--fg); }
.menu a.is-active { background: var(--accent); color: var(--on-accent); }
.menu-title { margin: 14px 12px 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.badge { background: var(--gold); color: var(--gold-fg); border-radius: 10px; padding: 0 7px; font-size: 0.74rem; font-weight: 800; line-height: 1.55; }

.me { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 12px; display: grid; gap: 10px; }
.me-row { display: flex; align-items: center; gap: 4px; }
.me-link { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 12px; color: inherit; text-decoration: none; }
.me-link:hover, .me-link.is-active { background: var(--fill); color: inherit; }
.me-link strong { display: block; font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-link small { color: var(--muted); }
.me .link-button { color: var(--muted); padding: 10px; border-radius: 50%; display: grid; place-items: center; }
.me .link-button:hover { color: var(--fg); background: var(--fill); text-decoration: none; }

.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; background: var(--fill); border-radius: 11px; }
.theme-switch button { border: 0; background: transparent; min-height: 30px; border-radius: 8px; font-size: 0.76rem; font-weight: 650; color: var(--fg-2); cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 3px 8px rgba(0,0,0,0.06); }

.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; font-size: 0.78rem;
}
.avatar-soft { background: var(--accent-soft); color: var(--accent-strong); }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; background: var(--accent); color: var(--on-accent); box-shadow: inset 0 0 0 2px var(--gold); }
.avatar-xs { width: 24px; height: 24px; font-size: 0.62rem; }

.main { padding: 30px 40px 64px; max-width: 1280px; width: 100%; min-width: 0; animation: viewIn 0.32s var(--ease); }
@keyframes viewIn { from { opacity: 0.85; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; }
.page-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.back { display: inline-flex; align-items: center; gap: 2px; font-size: 0.95rem; font-weight: 600; text-decoration: none; margin-bottom: 8px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; }

/* ---------------- Mensagens ---------------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; animation: viewIn 0.3s var(--ease); }
.flash-success { background: var(--ok-soft); color: var(--fg); }
.flash-error { background: var(--danger-soft); color: var(--fg); }
.flash-warn { background: var(--gold-soft); color: var(--fg); }
.flash a { font-weight: 600; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

/* ---------------- Cartões e grades ---------------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; min-width: 0; box-shadow: var(--shadow); }
.stack > .card { margin-bottom: 0; }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head a { font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.card-warn { background: var(--gold-soft); box-shadow: none; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.grid-3 > .card { margin-bottom: 0; }
.align-start { align-items: start; }
.narrow { max-width: 560px; }
.narrow-wide { max-width: 720px; }
.empty { padding: 26px 0; max-width: 560px; }
.empty .btn { margin-top: 6px; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 18px; padding: 0; }
.figures div { padding: 16px 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.figures dt { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.figures dd { margin: 4px 0 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------------- Botões ---------------- */
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
  min-height: 42px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--fill); color: var(--fg);
  transition: transform 0.15s var(--ease), background 0.2s, filter 0.2s;
}
.btn:hover { background: var(--fill-2); color: var(--fg); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent); color: var(--on-accent); filter: brightness(1.1); }
.btn-accent { background: var(--gold); color: var(--gold-fg); box-shadow: 0 4px 14px color-mix(in srgb, var(--gold) 35%, transparent); }
.btn-accent:hover { background: var(--gold); color: var(--gold-fg); filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-ghost:hover, .btn-ghost.is-active { background: var(--fill); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger); background: var(--danger-soft); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 0.88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.link-button { background: none; border: 0; font: inherit; color: var(--accent); cursor: pointer; padding: 4px; font-weight: 600; }
.link-button:hover { text-decoration: underline; }
.icon-button {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; list-style: none; transition: background 0.2s;
}
.icon-button:hover { background: var(--fill); color: var(--fg); }
.icon-button::-webkit-details-marker { display: none; }

/* WhatsApp: só abre a conversa, não registra nada */
.wa {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border-radius: 16px; background: var(--wa); color: #fff; font-weight: 650; font-size: 0.86rem; text-decoration: none; white-space: nowrap;
  transition: transform 0.15s var(--ease);
}
.wa:hover { background: var(--wa-hover); color: #fff; }
.wa:active { transform: scale(0.95); }
.wa-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn-block.wa, .stack-tight .wa { justify-content: center; min-height: 42px; border-radius: 12px; }
.phone-cell { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------------- Etiquetas ---------------- */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.tag { display: inline-block; font-size: 0.74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--fill); color: var(--fg-2); vertical-align: 1px; white-space: nowrap; }
.tag-stage { background: var(--accent-soft); color: var(--accent-strong); }
.tag-warn { background: var(--gold-soft); color: var(--gold-deep); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-contact { background: var(--accent); color: var(--on-accent); font-size: 0.66rem; }
.temp { display: inline-block; font-size: 0.72rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
.temp-quente { background: var(--hot-soft); color: var(--hot); }
.temp-morno { background: var(--gold-soft); color: var(--gold-deep); }
.temp-frio { background: var(--cold-soft); color: var(--cold); }
.status-disponivel { background: var(--ok-soft); color: var(--ok); }
.status-reservado { background: var(--gold-soft); color: var(--gold-deep); }
.status-vendido, .status-alugado { background: var(--cold-soft); color: var(--cold); }

/* ---------------- Filtros ---------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 600; }
.filters select { font-weight: 600; }
.filter-search { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.filter-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filter-search input[type=search], .filter-search input { padding-left: 38px; width: 100%; }
.input-short { width: 130px !important; }
.presets { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ---------------- Formulários ---------------- */
.form { display: grid; gap: 14px; }
.form-tight { gap: 8px; }
.form-wide { max-width: 920px; }
.form-wide .card { margin-bottom: 0; }
.form label, .form fieldset legend { display: grid; gap: 5px; align-content: end; font-weight: 650; font-size: 0.86rem; color: var(--fg-2); }
.form label small, legend small { font-weight: 500; color: var(--muted); margin-top: -3px; }
.form label.check { align-content: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 5; padding: 10px; margin: 0 -10px; border-radius: 16px; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
label.check, .form label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number],
input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--fg);
  min-height: 42px; padding: 9px 12px; border: 1px solid transparent; border-radius: 12px; background: var(--fill);
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.filters select, .filters input { width: auto; }
textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=color] { width: 42px; height: 42px; padding: 3px; border: 0; border-radius: 12px; background: var(--fill); cursor: pointer; flex: none; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type=text] { font-family: ui-monospace, "SF Mono", Menlo, monospace; text-transform: uppercase; max-width: 130px; }

/* Controle segmentado (iOS) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--fill); border-radius: 12px; justify-self: start; }
.segmented legend { margin-bottom: 6px; float: left; width: 100%; }
.segmented label { display: inline-flex; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 9px; font-size: 0.88rem; font-weight: 650; color: var(--fg-2); transition: background 0.2s var(--ease), box-shadow 0.2s; }
.segmented input:checked + span { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 3px 8px rgba(0,0,0,0.06); }
.segmented input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 1px; }
.segmented-lg span { min-height: 40px; padding: 0 18px; }
.segmented-lg { margin-bottom: 16px; }
fieldset.segmented { display: flex; }
.inline-select { display: inline-flex !important; align-items: center; gap: 8px !important; grid-auto-flow: column; font-size: 0.86rem; }
.inline-select select { width: auto; min-height: 36px; }

/* Abas de página no mesmo formato segmentado */
.segmented-nav { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--fill); border-radius: 12px; margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.segmented-nav a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 16px; border-radius: 9px; font-size: 0.9rem; font-weight: 650; color: var(--fg-2); text-decoration: none; white-space: nowrap; }
.segmented-nav a:hover { color: var(--fg); }
.segmented-nav a.is-active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 3px 8px rgba(0,0,0,0.06); }

/* Upload de logo */
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.upload-field { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.upload-preview { width: 96px; height: 96px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; padding: 8px; text-align: center; }
.upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload-logo_light { background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.upload-logo_dark { background: #17170F; }
.upload-logo_dark .muted { color: #A6A6A0; }
.upload-symbol { background: var(--fill); }
.upload-body { display: grid; gap: 6px; justify-items: start; }
.upload-body b { font-size: 0.92rem; color: var(--fg); }
.upload-body small { font-weight: 500; line-height: 1.35; }

/* ---------------- Tabelas (lista agrupada) ---------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-plain { box-shadow: none; border-radius: 0; margin: 0 -20px; background: transparent; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 650; font-size: 0.78rem; color: var(--muted); padding: 12px 16px 8px; white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.is-off td { color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { display: inline-flex; vertical-align: middle; }
.table a { text-decoration: none; }
.table a strong { color: var(--fg); }
.table a:hover strong { color: var(--accent); }
.col-check { width: 40px; }
.col-check input { width: 20px; height: 20px; accent-color: var(--accent); }

.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 10px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-sm); }
.bulk-bar label { display: inline-flex; align-items: center; gap: 8px; }
.bulk-bar select { width: auto; min-height: 36px; background: var(--surface); }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ---------------- Menus suspensos ---------------- */
.menu-pop { position: relative; display: inline-block; text-align: left; }
.menu-pop > summary { cursor: pointer; list-style: none; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-pop:not(:has(> summary.btn)):not(:has(> summary.icon-button)) > summary { color: var(--accent); font-weight: 650; padding: 6px; }
.menu-pop[open] > div {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 280px;
  background: var(--surface); border-radius: 16px; border: 1px solid var(--glass-line);
  padding: 14px; display: grid; gap: 12px; box-shadow: var(--shadow-lg); white-space: normal;
  animation: viewIn 0.2s var(--ease);
}
.menu-pop[open] > div .btn { justify-content: flex-start; }

/* ---------------- Listas ---------------- */
.agenda-list, .people-list, .plain-list, .timeline, .bars, .stage-list, .mail-list, .attachments { list-style: none; margin: 0; padding: 0; }
.agenda-list li, .people-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.agenda-list li:first-child, .people-list li:first-child { border-top: 0; }
.agenda-list .when { width: 54px; flex: none; text-align: center; line-height: 1.2; font-variant-numeric: tabular-nums; }
.agenda-list .when b { display: block; font-size: 1.02rem; }
.agenda-list .when small { color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.agenda-list .what, .people-list .what { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.agenda-list .what small, .people-list .what small { color: var(--muted); font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-list .what a { color: inherit; text-decoration: none; }
.agenda-list .what a:hover b, .people-list a.what:hover b { color: var(--accent); }
.agenda-list li.is-late .when b, .agenda-list li.is-late .when small { color: var(--danger); }
.plain-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.plain-list li:first-child { border-top: 0; }

.data-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 0.94rem; }
.data-list dt { color: var(--muted); }
.data-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.data-list .wa { min-height: 30px; padding: 0 10px; font-size: 0.82rem; }
.notes { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 0.93rem; }

/* ---------------- Funil (início e relatórios) ---------------- */
.funnel-total { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.funnel-total strong { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.funnel-bar { display: flex; gap: 3px; height: 12px; border-radius: 6px; overflow: hidden; margin-bottom: 14px; background: var(--fill); }
.funnel-bar span { display: block; min-width: 6px; }
.funnel-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 18px; }
.funnel-steps li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; font-size: 0.9rem; }
.funnel-steps i { width: 10px; height: 10px; border-radius: 3px; }

.bars li { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; align-items: center; gap: 12px; padding: 7px 0; font-size: 0.9rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--fill); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; min-width: 3px; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

/* ---------------- Imóveis ---------------- */
.prop-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.thumb { width: 56px; height: 42px; border-radius: 9px; object-fit: cover; flex: none; background: var(--fill); display: block; }
.hero { display: block; position: relative; margin: -18px -20px 14px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; aspect-ratio: 16 / 9; background: var(--fill); }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero span { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,0.55); color: #fff; font-size: 0.78rem; font-weight: 650; padding: 4px 10px; border-radius: 999px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
@media (max-width: 600px) { .hero { margin: -16px -16px 12px; } }

/* ---------------- Ficha do contato ---------------- */
.contact-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px; }
.contact-head .back { grid-column: 1 / -1; margin-bottom: 0; }
.contact-title { display: flex; align-items: center; gap: 16px; min-width: 0; }
.contact-grid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.price { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--accent-strong); }

.deal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.card-head + .deal, .card-head + p + .deal { border-top: 0; }
.deal-main { flex: 1 1 220px; min-width: 0; }
.deal-main > a { color: var(--fg); text-decoration: none; }
.deal-main > a:hover { color: var(--accent); }
.deal-stage select { width: auto; min-height: 36px; font-size: 0.88rem; font-weight: 650; }
.deal-ganho .deal-main b, .deal-perdido .deal-main b { color: var(--muted); }

.log-form { margin-bottom: 14px; }
.log-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--fill); border-radius: 12px; margin-bottom: 6px; }
.tabs a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 13px; border-radius: 9px; font-size: 0.86rem; font-weight: 650; color: var(--fg-2); text-decoration: none; }
.tabs a:hover { color: var(--fg); }
.tabs a.is-active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 3px 8px rgba(0,0,0,0.06); }

.timeline li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.timeline li:first-child { border-top: 0; }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--fg-2); }
.tl-email_recebido .tl-icon, .tl-email_enviado .tl-icon { background: var(--cold-soft); color: var(--cold); }
.tl-whatsapp .tl-icon { color: var(--wa); }
.tl-visita .tl-icon { background: var(--gold-soft); color: var(--gold-deep); }
.tl-ligacao .tl-icon { background: var(--accent-soft); color: var(--accent-strong); }
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.tl-head b { font-size: 0.93rem; }
.tl-body p { margin: 4px 0 0; font-size: 0.93rem; color: var(--fg-2); overflow-wrap: anywhere; }
.tl-sistema .tl-head b { font-weight: 550; color: var(--fg-2); }
.tl-delete { display: inline; margin-left: 6px; }
.tl-delete .link-button { color: var(--muted); }

/* ---------------- Quadro do funil ---------------- */
.board-hint { margin: -6px 0 12px; }
.board-wrap { overflow-x: auto; padding-bottom: 10px; margin: 0 -40px; padding-left: 40px; padding-right: 40px; scroll-snap-type: x proximity; scroll-padding-left: 40px; }
.board { display: grid; grid-template-columns: repeat(var(--cols), minmax(240px, 1fr)); gap: 12px; min-width: calc(var(--cols) * 252px); }
.board-col { background: var(--fill); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; min-height: 420px; scroll-snap-align: start; }
.board-col header { display: flex; align-items: center; gap: 8px; padding: 4px 6px; }
.board-col header i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.board-col h2 { font-size: 0.92rem; flex: 1; }
.board-col .count { font-weight: 800; font-size: 0.85rem; color: var(--fg-2); }
.col-sum { font-size: 0.8rem; color: var(--muted); margin: 0 6px 8px; font-variant-numeric: tabular-nums; }
.board-cards { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 14px; transition: background 0.2s; }
.board-cards.is-over { background: var(--fill); outline: 2px dashed var(--accent); outline-offset: 2px; }
.deal-card { background: var(--surface); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 3px; cursor: grab; box-shadow: var(--shadow); transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.deal-card:hover { transform: translateY(-1px); }
.deal-card.is-dragging { opacity: 0.45; }
.deal-card-name { font-weight: 700; color: var(--fg); text-decoration: none; }
.deal-card-name:hover { color: var(--accent); }
.deal-card .temp { align-self: flex-start; margin-left: 0; }
.deal-card-title { font-size: 0.85rem; color: var(--fg-2); }
.deal-card-value { font-size: 0.9rem; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.deal-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.deal-card-foot small { flex: 1; font-size: 0.78rem; display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.deal-card-foot .late { color: var(--danger); font-weight: 650; }
.deal-card-foot .wa-icon { width: 30px; height: 30px; min-height: 30px; }
.deal-card-move { margin-top: 6px; }
.deal-card-move select { min-height: 32px; font-size: 0.8rem; padding: 3px 8px; border-radius: 9px; }
.js .deal-card-move { display: none; }

/* ---------------- Agenda ---------------- */
.legend { display: inline-flex; flex-wrap: wrap; gap: 12px; margin-left: auto; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.legend-item::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; background: var(--ev); }
.ev-visita { --ev: #D79A2B; }
.ev-testdrive { --ev: #C2412D; }
.ev-tarefa { --ev: var(--accent); }
.ev-ligacao { --ev: #3D6E95; }
.ev-compromisso { --ev: #8A6A9A; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border-radius: var(--radius); min-height: 190px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; box-shadow: var(--shadow); }
.day header { display: flex; align-items: center; gap: 6px; padding: 2px 2px 8px; }
.day header span { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.day header b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.day-add { margin-left: auto; color: var(--muted); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.day-add:hover { background: var(--fill); color: var(--fg); }
.day.is-today header b { background: var(--accent); color: var(--on-accent); border-radius: 50%; width: 30px; height: 30px; display: inline-grid; place-items: center; font-size: 1rem; }
.event { border-left: 3px solid var(--ev, var(--accent)); background: var(--surface-2); border-radius: 4px 10px 10px 4px; padding: 7px 7px 5px 9px; display: flex; flex-direction: column; gap: 2px; font-size: 0.84rem; }
.event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; line-height: 1.3; }
.event-main time { font-weight: 800; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.event-main b { font-weight: 650; overflow-wrap: break-word; hyphens: auto; }
.event-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.event-actions .wa-icon { width: 30px; height: 30px; min-height: 30px; }
.event-actions .icon-button { width: 30px; height: 30px; }
.event.is-done { opacity: 0.55; }
.event.is-done b { text-decoration: line-through; }

/* ---------------- Email ---------------- */
.mail { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
.mail:has(.mail-contact) { grid-template-columns: 210px minmax(0, 1fr) 260px; }
.mail-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
.mail-account { overflow-wrap: anywhere; margin: 0; }
.folders { display: flex; flex-direction: column; gap: 2px; }
.folders a { display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 11px; color: var(--fg-2); text-decoration: none; font-weight: 600; }
.folders a:hover { background: var(--fill); color: var(--fg); }
.folders a.is-active { background: var(--accent); color: var(--on-accent); }
.folders b { font-size: 0.8rem; }
.mail-main { min-width: 0; }
.mail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.mail-search { flex: 0 1 340px; }
.mail-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.mail-list li + li { border-top: 1px solid var(--line-soft); }
.mail-list a { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 16px; color: var(--fg); text-decoration: none; }
.mail-list a:hover { background: var(--surface-2); }
.mail-from, .mail-subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject { color: var(--fg-2); }
.mail-date { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.mail-list .is-unread a { font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
.mail-list .is-unread .mail-subject { color: var(--fg); }
.mail-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.mail-toolbar form { display: inline-flex; gap: 4px; }
.mail-message { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.mail-message h1 { font-size: 1.4rem; margin-bottom: 10px; }
.mail-meta { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 16px; }
.mail-frame { width: 100%; height: 320px; border: 0; display: block; background: #fff; border-radius: 10px; }
.mail-text { white-space: normal; overflow-wrap: anywhere; font-size: 0.95rem; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.attachments li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 12px; background: var(--fill); font-size: 0.88rem; max-width: 100%; }
.attachments a:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.mail-contact { background: var(--surface); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; box-shadow: var(--shadow); }
.mail-contact h2 { font-size: 0.78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.contact-mini { display: flex; gap: 10px; align-items: center; }
.contact-mini .avatar { background: var(--accent); color: var(--on-accent); }

.compose { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; gap: 10px; box-shadow: var(--shadow); }
.compose-row { display: grid !important; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 10px !important; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); font-weight: 500 !important; }
.compose-label { color: var(--muted); font-size: 0.88rem; }
.compose-row input { background: transparent; padding-left: 4px; }
.compose-more summary { font-size: 0.86rem; color: var(--accent); cursor: pointer; font-weight: 650; padding: 2px 0; }
.compose textarea { min-height: 300px; font-size: 0.95rem; }
.compose-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.file-pick { white-space: nowrap; max-width: 100%; overflow: hidden; display: inline-flex !important; align-items: center; gap: 6px !important; grid-auto-flow: column; min-height: 36px; padding: 0 14px; border-radius: 10px; background: var(--fill); cursor: pointer; font-size: 0.86rem; font-weight: 650; color: var(--accent); position: relative; }
.file-pick:hover { background: var(--fill-2); }
.file-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-pick:focus-within { outline: 3px solid var(--gold); }

/* ---------------- Configurações ---------------- */
.stage-list li { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.stage-list li:first-child { border-top: 0; padding-top: 0; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row .grow { flex: 1; }
.stage-tools { display: flex; align-items: center; gap: 4px; margin-top: 4px; padding-left: 50px; }
.stage-tools small { flex: 1; }
.stage-new { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
pre.code { background: var(--surface-2); color: var(--fg-2); padding: 14px; border-radius: 12px; overflow-x: auto; font-size: 0.8rem; line-height: 1.5; }
details > summary { cursor: pointer; }

/* ---------------- Login e instalação ---------------- */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(120% 80% at 50% 0%, var(--accent-soft), var(--bg) 70%); }
.guest-box { width: 100%; max-width: 420px; background: var(--surface); border-radius: 26px; padding: 32px 30px; box-shadow: var(--shadow-lg); animation: viewIn 0.4s var(--ease); }
.guest-brand { display: flex; justify-content: center; margin: 0 0 22px; }
.guest-brand .brand-text { font-size: 1.5rem; }
.guest-box h1 { font-size: 1.5rem; margin-bottom: 20px; text-align: center; }
.guest-box h2 { margin: 22px 0 12px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.checks li { display: flex; gap: 10px; }
.checks .ok { color: var(--ok); font-weight: 650; }
.checks .fail { color: var(--danger); font-weight: 650; }
.checks span { color: var(--fg); font-weight: 400; }
.callout { margin-top: 18px; padding: 14px; border-radius: var(--radius-sm); background: var(--gold-soft); font-size: 0.9rem; }
.callout p { margin: 0 0 10px; }

/* ---------------- Telas menores ---------------- */
@media (max-width: 1100px) {
  .mail:has(.mail-contact) { grid-template-columns: 200px minmax(0, 1fr); }
  .mail-contact { grid-column: 2; position: static; }
  .week { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .day.is-empty { min-height: 0; }
}

/* Celular: barra superior translúcida, abas embaixo e menu como folha (sheet) */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 40;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px 16px; min-height: 54px;
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--glass-line);
  }
  .topbar .brand { flex: 1; padding: 0; flex-direction: row; align-items: center; }
  .topbar .brand-text { font-size: 1.05rem; }
  .topbar-add { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--gold-fg); }
  .topbar-add:hover { color: var(--gold-fg); filter: brightness(1.05); }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--glass-line);
  }
  .tabbar a, .tabbar label {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px;
    color: var(--muted); text-decoration: none; font-size: 0.68rem; font-weight: 650; cursor: pointer; position: relative;
  }
  .tabbar .is-active { color: var(--accent-strong); }
  .tabbar .badge { position: absolute; top: 2px; left: 54%; font-size: 0.64rem; }

  /* Menu completo abre como folha de baixo para cima */
  .sidebar {
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; top: auto; height: auto; max-height: 86vh;
    border-right: 0; border-radius: 24px 24px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform 0.36s var(--ease); visibility: hidden;
  }
  .sidebar > .brand { display: none; }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 6px; flex: none; }
  .nav-toggle:checked ~ .sidebar { transform: none; visibility: visible; }
  .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,0.38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
  .sidebar .menu { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .sidebar .menu-title { grid-column: 1 / -1; }
  .sidebar .menu a { min-height: 48px; background: var(--fill); }
  .sidebar .menu a.is-active { background: var(--accent); }
  .sidebar .quick-add { display: none; }

  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 1.85rem; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-head { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .board-wrap { margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding-left: 16px; }
  .board { grid-template-columns: repeat(var(--cols), minmax(260px, 82vw)); min-width: 0; }
  .mail, .mail:has(.mail-contact) { grid-template-columns: 1fr; }
  .mail-side { position: static; }
  .mail-contact { grid-column: auto; }
  .folders { flex-direction: row; overflow-x: auto; }
  .folders a { white-space: nowrap; gap: 8px; }
  .mail-list a { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
  .mail-from { grid-column: 1; }
  .mail-date { grid-column: 2; grid-row: 1; }
  .mail-subject { grid-column: 1 / -1; }
  .table-plain { margin: 0 -20px; }
  .sticky-actions { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .figures { grid-template-columns: 1fr 1fr; gap: 10px; }
  .figures dd { font-size: 1.3rem; }
  .card { padding: 16px; }
  .table-plain { margin: 0 -16px; }
  .filters > label:not(.filter-search):not(.check), .filters select { flex: 1 1 calc(50% - 8px); }
  .filters select { width: 100%; }
  .legend { margin-left: 0; }
  .bars li { grid-template-columns: 1fr auto; }
  .bars .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .compose-row { grid-template-columns: 1fr; gap: 2px !important; }
  .page-head-row .actions-row { width: 100%; }
  .upload-field { grid-template-columns: 80px minmax(0, 1fr); }
  .upload-preview { width: 80px; height: 80px; }
  .guest-box { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Resumo do imóvel no formulário do negócio */
.prop-summary { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.prop-summary img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; }
.prop-summary div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prop-summary small { color: var(--fg-2); }
.visit-hint { display: block; margin-top: 4px; }
.figures-3 { grid-template-columns: repeat(3, 1fr); margin: 0; }
.figures-3 div { box-shadow: none; background: var(--fill); padding: 12px 14px; }
/* Funis nas configurações */
.input-title { font-weight: 700; font-size: 1.05rem; max-width: 360px; }
.pipeline-vis { border: 0; padding: 0; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.pipeline-vis legend { font-weight: 650; margin-bottom: 4px; }
.pipeline-vis .chips { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-left: 26px; }
.sub-h { font-size: 0.95rem; margin: 18px 0 8px; }
.inline-end { display: flex; justify-content: flex-end; margin-top: 10px; }

/* Funil de aproveitamento (relatórios) */
.mt-lg { margin-top: 18px; }
.card-head-wrap { flex-wrap: wrap; }
.cfun { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cfun li { display: grid; grid-template-columns: minmax(96px, 170px) 1fr minmax(118px, 150px); gap: 12px; align-items: center; font-size: .9rem; }
.cfun .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cfun .bar { display: flex; justify-content: center; }
.cfun .bar i { display: flex; align-items: center; justify-content: center; height: 34px; min-width: 34px; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.cfun li.won .bar i { background: var(--ok); color: #fff; }
.cfun .pc { font-size: .82rem; color: var(--muted); line-height: 1.25; font-variant-numeric: tabular-nums; }
.cfun .pc b { color: var(--fg); font-size: .92rem; }
@media (max-width: 640px) { .cfun li { grid-template-columns: 1fr; gap: 4px; } .cfun .bar { justify-content: flex-start; } }

/* Financeiro */
.table .r, .table th.r { text-align: right; }
.nowrap { white-space: nowrap; }
.pos { color: var(--ok); font-weight: 650; }
.neg { color: var(--danger); font-weight: 650; }
.figures small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; }
.card-warn { border: 1px solid var(--gold); }
.inline { display: inline; }
.file-btn { cursor: pointer; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.table .sub { display: block; margin-top: 2px; }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

/* Campanhas */
.insights li { display: flex; gap: 10px; align-items: baseline; }
.insights .tag { flex: none; }
.table tr.is-selected td { background: var(--fill); }
.copy-line { word-break: break-all; font-size: 0.74rem; }
.block { display: block; }
.insights li > span:last-child { flex: 1; }

.board-more { display: block; margin: .5rem auto 0; text-align: center; }
.lookup { position: relative; }
.lookup input[type="search"] { width: 100%; }
.lookup-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--card, #fff); border: 1px solid var(--line, #ddd); border-radius: var(--radius, 10px); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow: auto; }
.lookup-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.lookup-list li:hover, .lookup-list li[aria-selected="true"] { background: var(--fill, #f2f2f2); }
.lookup-list .lookup-empty { color: var(--muted, #777); cursor: default; }

/* ================= WhatsApp ================= */
.btn-wa { background: var(--wa); color: #fff; border-color: transparent; }
.btn-wa:hover { background: var(--wa-hover); }
.wap { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; height: calc(100vh - 120px); height: calc(100dvh - 120px); min-height: 480px; }
.wap > .card { margin: 0; padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wa-list-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.wa-list-head h1 { font-size: 1.35rem; margin: 0; }
.wa-search { padding: 0 12px 8px; }
.wa-search .filter-search { width: 100%; }
.wa-filters { display: flex; gap: 6px; margin-top: 8px; }
.wa-filters a { font-size: .84rem; padding: 4px 12px; border-radius: 999px; background: var(--fill); color: var(--fg-2); text-decoration: none; }
.wa-filters a.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.wa-rows { overflow-y: auto; flex: 1; padding: 0 6px 8px; }
.wa-row { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; align-items: flex-start; }
.wa-row:hover { background: var(--fill); }
.wa-row.is-active { background: var(--accent-soft); }
.wa-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wa-row-top, .wa-row-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wa-row-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-row-top small { color: var(--muted); flex: none; font-size: .75rem; }
.wa-row.is-unread .wa-row-top small { color: var(--wa); font-weight: 700; }
.wa-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); font-size: .88rem; }
.wa-row.is-unread .wa-prev { color: var(--fg); font-weight: 600; }
.wa-unread { background: var(--wa); color: #fff; border-radius: 999px; font-size: .72rem; min-width: 20px; text-align: center; padding: 1px 6px; flex: none; }
.wa-row-meta { font-size: .72rem; }
.wa-empty { padding: 16px; }
.wa-alert { margin: 0 12px 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: .86rem; }
.wa-alert a { color: inherit; font-weight: 700; }
.wa-chat .wa-alert { margin: 8px 16px 0; }
.wa-placeholder { margin: auto; text-align: center; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.wa-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.wa-chat-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-chat-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-back { display: none; color: inherit; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); }
.wa-mini { max-height: 260px; border-radius: var(--radius-sm); padding: 10px; margin-top: 8px; }
.wa-day { text-align: center; margin: 10px 0; }
.wa-day span { font-size: .74rem; background: var(--surface); color: var(--muted); padding: 3px 10px; border-radius: 999px; }
.wa-msg { display: flex; }
.wa-msg.out { justify-content: flex-end; }
.wa-bubble { max-width: min(78%, 560px); padding: 7px 10px 5px; border-radius: 14px; background: var(--surface); box-shadow: 0 1px 1px rgba(0,0,0,.06); position: relative; }
.wa-msg.out .wa-bubble { background: #DCF5DE; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-msg.out .wa-bubble { background: #1F3A2A; } }
:root[data-theme="dark"] .wa-msg.out .wa-bubble { background: #1F3A2A; }
.wa-msg.in .wa-bubble { border-top-left-radius: 4px; }
.wa-msg.out .wa-bubble { border-top-right-radius: 4px; }
.wa-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-bubble a { overflow-wrap: anywhere; }
.wa-meta { display: block; text-align: right; font-size: .7rem; color: var(--muted); margin-top: 2px; }
.wa-tick { font-style: normal; letter-spacing: -2px; }
.wa-tick.s-read { color: #2B8ED8; }
.wa-tick.s-failed { color: var(--danger); letter-spacing: 0; font-weight: 800; }
.wa-msg.failed .wa-bubble { outline: 1px solid var(--danger); }
.wa-err { display: block; color: var(--danger); font-size: .74rem; }
.wa-img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: 4px; }
.wa-img.sticker { max-width: 140px; background: transparent; }
.wa-bubble audio { width: 260px; max-width: 100%; }
.wa-bubble video { max-width: 100%; max-height: 320px; border-radius: 10px; }
.wa-doc { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--fill); border-radius: 10px; text-decoration: none; }
.wa-readonly { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: .84rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.wa-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.wa-tools { display: flex; gap: 4px; }
.wa-input { flex: 1; }
.wa-input textarea { width: 100%; resize: none; max-height: 160px; min-height: 42px; line-height: 1.4; }
.wa-send { min-width: 44px; }
.wa-pop { position: relative; }
.wa-pop summary { list-style: none; }
.wa-pop summary::-webkit-details-marker { display: none; }
.wa-pop-box { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; width: 300px; max-height: 320px; overflow: auto; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.wa-pop-box button { all: unset; cursor: pointer; padding: 8px 10px; border-radius: 8px; display: grid; gap: 2px; }
.wa-pop-box button:hover, .wa-pop-box button:focus-visible { background: var(--fill); }
.wa-pop-box small { color: var(--muted); }
.wa-pop-box a { padding: 8px 10px; font-size: .84rem; }
.wa-items { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, 94vw); max-height: 80vh; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-lg); }
.wa-items::backdrop { background: rgba(0,0,0,.35); }
.wa-items-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.wa-items input[type=search] { margin: 0 16px 8px; width: calc(100% - 32px); }
.wa-items ul { list-style: none; margin: 0; padding: 0 8px 12px; overflow: auto; max-height: 60vh; }
.wa-items li button { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; }
.wa-items li button span { display: grid; }
.wa-items li button:hover { background: var(--fill); }
.wa-state { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.wa-state.ok { background: var(--ok-soft); color: var(--ok); }
.wa-state.warn { background: var(--gold-soft); color: var(--gold-deep); }
.wa-state.bad { background: var(--danger-soft); color: var(--danger); }
.wa-new { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.wa-connect { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.wa-qr-box { text-align: center; }
.wa-qr { width: 280px; height: 280px; display: grid; place-items: center; background: #fff; border-radius: var(--radius-sm); padding: 8px; }
.wa-qr img { width: 264px; height: 264px; image-rendering: pixelated; }
.wa-ok { color: var(--ok); font-size: 1.4rem; font-weight: 800; }
.wa-pair { font-family: ui-monospace, monospace; font-size: 2rem; letter-spacing: .2em; color: #111; }
.wa-steps { line-height: 1.8; }
.inline { display: inline; }
.inline-menu { display: inline-block; position: relative; }
.inline-menu summary { list-style: none; }
.inline-menu > div { position: absolute; right: 0; z-index: 10; background: var(--surface); box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding: 6px; min-width: 200px; }
.inline-menu button { all: unset; display: block; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.inline-menu button:hover { background: var(--fill); }
.inline-menu button.danger { color: var(--danger); }
@media (max-width: 900px) {
  .wap { grid-template-columns: 1fr; height: calc(100vh - 210px); height: calc(100dvh - 210px); min-height: 360px; }
  .wap.has-chat .wa-list { display: none; }
  .wap:not(.has-chat) .wa-chat { display: none; }
  .wa-back { display: inline-flex; }
  .wa-connect { grid-template-columns: 1fr; justify-items: center; }
}

/* ================= Privacidade (LGPD) ================= */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0 12px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.privacy-danger { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.privacy-danger summary { cursor: pointer; color: var(--danger); font-weight: 650; font-size: .9rem; }
.privacy-danger form { margin-top: 10px; padding: 10px; background: var(--fill); border-radius: var(--radius-sm); }
.privacy-fields, .docs-fields { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.privacy-fields summary, .docs-fields summary { cursor: pointer; font-weight: 650; color: var(--fg-2); }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; }
.check-list .st { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.check-list .st.ok { background: var(--ok-soft); color: var(--ok); }
.check-list .st.no { background: var(--danger-soft); color: var(--danger); }
.check-list .st.warn { background: var(--gold-soft); color: var(--gold-deep); }
.code-box { font-family: ui-monospace, monospace; font-size: .8rem; white-space: pre-wrap; background: var(--fill); padding: 10px; border-radius: var(--radius-sm); overflow-x: auto; }

/* ================= Segurança ================= */
.twofa-setup { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: start; }
.twofa-qr { width: 232px; height: 232px; background: #fff; padding: 12px; border-radius: var(--radius-sm); }
.twofa-qr svg, .twofa-qr img { width: 100%; height: 100%; display: block; }
.secret { font-size: .95rem; letter-spacing: .05em; user-select: all; }
.recovery-card { border: 2px solid var(--gold); }
.recovery-codes { columns: 2; font-size: 1.05rem; line-height: 2; padding-left: 22px; }
.recovery-codes code { font-family: ui-monospace, monospace; letter-spacing: .05em; user-select: all; }
@media (max-width: 700px) { .twofa-setup { grid-template-columns: 1fr; justify-items: center; } }

/* Segurança (painel do admin) */
.card-alert { border-color: var(--danger, #c0392b); box-shadow: inset 4px 0 0 var(--danger, #c0392b); }
.check-list .check { display: inline-flex; margin: 0; }

/* ===== Ajustes Trifatto: cartão do negócio, captação, plano de marketing ===== */
.deal-dialog { width: min(1080px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: var(--radius); background: var(--bg); color: var(--fg); box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.deal-dialog::backdrop { background: rgba(20, 20, 14, .45); }
.deal-dialog-body { max-height: calc(100dvh - 24px); overflow: auto; padding: 22px 24px 8px; overscroll-behavior: contain; }
.deal-dialog-close { position: absolute; top: 10px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill); color: var(--fg); font-size: 22px; line-height: 1; cursor: pointer; }
.deal-view.is-modal .deal-view-head { padding-right: 40px; }
.deal-view-head h1 { margin: 2px 0 6px; }
.deal-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.deal-card.is-stale { box-shadow: inset 3px 0 0 var(--danger), var(--shadow); }
.deal-card { cursor: pointer; }
.close-deal { margin-top: 12px; }
.close-deal > summary { list-style: none; }
.close-deal > summary::-webkit-details-marker { display: none; }
.close-deal[open] > summary { margin-bottom: 10px; }
.close-deal .form + .form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.cap-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.cap-values div { background: var(--fill); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cap-values small { color: var(--fg-2); font-size: .76rem; }
.cap-values b { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cap-values em { font-style: normal; font-size: .78rem; font-weight: 700; }
.cap-values em.pos { color: var(--ok); } .cap-values em.neg { color: var(--danger); }
.gestao { margin: 0 0 8px; font-size: .9rem; }
.gestao.is-ending { color: var(--gold-deep); } .gestao.is-expired { color: var(--danger); }
.check-month { border-top: 1px solid var(--line-soft); padding: 8px 0; }
.check-month > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.check-items { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.check-items form { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.check-items .check-box { width: 22px; height: 22px; margin-top: 1px; border-radius: 6px; border: 2px solid var(--line); background: var(--surface); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; padding: 0; }
.check-items .is-done .check-box { background: var(--accent); border-color: var(--accent); }
.check-items .is-done .check-text { color: var(--fg-2); text-decoration: line-through; text-decoration-color: var(--line); }
.check-items .is-late .check-text small { color: var(--danger); }
.late { color: var(--danger); }
.type-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 18px; }
.type-option { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; border: 2px solid transparent; transition: border-color .15s, transform .15s var(--ease); }
.type-option:hover, .type-option:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.type-option h2 { margin: 6px 0 0; }
fieldset[data-mode] { border: 0; padding: 0; margin-inline: 0; }
fieldset[data-mode][hidden] { display: none; }
.callout-warn { margin: 0 0 14px; }
@media (max-width: 860px) {
  .deal-grid, .type-choice { grid-template-columns: 1fr; }
  .deal-dialog-body { padding: 18px 14px 4px; }
  .cap-values { grid-template-columns: 1fr; }
}
.stage-row .stage-stale { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--fg-2); white-space: nowrap; }
.stage-row .stage-stale input { width: 64px; }
.stage-more { flex-basis: 100%; }
.stage-more[open] { display: grid; gap: 8px; padding: 8px 0; }
.want + .want { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.entries li + li { margin-top: 8px; }
.report-h { font-size: 1.05rem; margin: 26px 0 10px; color: var(--fg-2); text-transform: uppercase; letter-spacing: .04em; }
.figures-5 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.report-funnels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.report-funnels .card { margin-bottom: 0; }
.report-funnels h3, .grid-2 > .card > h3, #aproveitamento h3 { margin: 0 0 10px; font-size: 1rem; }
.bars-compact .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .is-exit { opacity: .6; }
.rank-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.report-table td.num, .report-table th.num { font-variant-numeric: tabular-nums; }
