:root {
  --brand: #0F766E;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-strong: color-mix(in srgb, var(--brand) 85%, black);
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --surface-2: #F8FAF9;
  --border: #E3E8E6;
  --text: #15201D;
  --muted: #64716D;
  --ok: #16A34A;
  --warn: #D97706;
  --bad: #DC2626;
  --shadow: 0 1px 2px rgba(16, 24, 22, .05), 0 4px 16px rgba(16, 24, 22, .04);
  --radius: 14px;
  --sidebar: 240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1413; --surface: #161E1C; --surface-2: #1C2523; --border: #2A3532; --text: #E7EEEC; --muted: #93A29E;
    --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] { --bg: #0E1413; --surface: #161E1C; --surface-2: #1C2523; --border: #2A3532; --text: #E7EEEC; --muted: #93A29E; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 10px; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.i { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* layout */
#app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand strong { display: block; font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.logo-mark .i { fill: #fff; stroke: none; }
.logo-img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; }
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 18px 10px 6px; }
.nav-count { margin-left: auto; font-style: normal; background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; padding: 1px 7px; }
.nav-count[hidden], .nav-count:empty { display: none; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.mode { font-size: 12px; color: var(--warn); padding: 0 8px; }
.mode.server { color: var(--ok); }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; }
.search > .i { position: absolute; left: 12px; color: var(--muted); }
.search input { width: 100%; padding: 10px 12px 10px 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit; color: var(--text); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: none; }
.search-results.open { display: block; }
.search-results button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; border-radius: 8px; text-align: left; }
.search-results button span:nth-child(2) { flex: 1; }
.search-results button:hover { background: var(--surface-2); }
.search-results p { padding: 8px; margin: 0; }
main { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.menu-btn { display: none; }
.scrim { display: none; }

/* elementos */
.btn { display: inline-flex; align-items: center; gap: 7px; justify-content: center; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.sm .i { width: 15px; height: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.input { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.input:focus, .search input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 0; border-color: var(--brand); }
.input.sm { padding: 6px 9px; font-size: 13px; width: auto; }
.input.color { padding: 3px; height: 40px; }
textarea.input { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
.field .input { color: var(--text); font-weight: 400; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.span2 { grid-column: span 2; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head .muted { font-size: 13px; }
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; color: color-mix(in srgb, var(--c) 80%, var(--text)); background: color-mix(in srgb, var(--c) 14%, transparent); }
.ch { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); flex: none; }
.ch .i { width: 14px; height: 14px; }
.ch:has(span) { width: auto; display: inline-flex; gap: 5px; padding: 0 8px 0 5px; font-size: 12px; font-weight: 500; }
.avatar { --h: 160; width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: hsl(var(--h) 45% 30%); background: hsl(var(--h) 55% 90%); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.badge { background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; margin-left: auto; font-weight: 600; }
.waiting { font-size: 11px; font-weight: 600; color: var(--warn); }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 12px; color: var(--muted); text-align: center; }
.empty .i { width: 26px; height: 26px; color: var(--brand); opacity: .6; }
.empty strong { color: var(--text); }
.err { color: var(--bad); font-size: 12px; }
.note { display: flex; gap: 12px; background: color-mix(in srgb, var(--warn) 8%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); line-height: 1.5; }
.note .i { color: var(--warn); margin-top: 2px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--brand); color: #fff; }

/* painel */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.kpi > span { color: var(--muted); font-size: 13px; }
.kpi strong { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.warn strong { color: var(--warn); }
.kpi.danger strong { color: var(--bad); }
.kpi-link { color: var(--brand); font-size: 12px; font-weight: 600; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.grid-side.wide { grid-template-columns: minmax(0, 1fr) 420px; }
.op-list { display: flex; flex-direction: column; max-height: 430px; overflow-y: auto; margin: 0 -6px; }
.op { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.op:last-child { border-bottom: 0; }
.op-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.op-sem-resposta .op-ic { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.op-retorno .op-ic, .op-parado .op-ic { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.op-aniversario .op-ic { background: color-mix(in srgb, #D62976 12%, transparent); color: #D62976; }
.op-body { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; }
.op-body span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-val { font-size: 13px; font-weight: 600; color: var(--ok); }
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 32px; align-items: center; gap: 10px; font-size: 13px; }
.funnel-row b { text-align: right; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; min-width: 4px; }
.columns { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 18px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.col i { display: block; width: 100%; max-width: 40px; background: var(--brand); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.col em { font-style: normal; font-size: 11px; color: var(--muted); }
.col span { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.src-list { display: flex; flex-direction: column; gap: 12px; }
.src { display: grid; grid-template-columns: 22px 92px 1fr 26px; align-items: center; gap: 8px; font-size: 13px; }
.src small { grid-column: 2 / -1; color: var(--muted); font-size: 12px; margin-top: -8px; }
.src b { text-align: right; }
.camp-mini { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.camp-mini span { color: var(--muted); font-size: 12px; }
.camp-stats { font-size: 13px; color: var(--muted); }
.camp-stats b { color: var(--text); }
.recover { margin-top: 14px; background: var(--brand-soft); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.recover span { font-size: 12px; color: var(--muted); }
.recover strong { font-size: 20px; color: var(--brand); }

/* conversas */
main[data-view="conversas"] { padding: 0; max-width: none; }
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 63px); }
.inbox-list { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.inbox-tools { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 3px 10px 3px 4px; font-size: 12px; font-weight: 500; }
.chip:first-child { padding-left: 10px; }
.chip:last-child { padding-left: 10px; }
.chip .ch { width: 18px; height: 18px; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.threads { overflow-y: auto; flex: 1; }
.thread { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.thread:hover { background: var(--surface-2); }
.thread.on { background: var(--brand-soft); }
.thread-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.thread-top { display: flex; justify-content: space-between; gap: 8px; }
.thread-top strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-top time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.thread-msg { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.thread-msg .ch { width: 18px; height: 18px; }
.thread-msg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-meta { display: flex; gap: 8px; align-items: center; }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-title { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.chat-title span { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.chat-actions { display: flex; gap: 6px; }
.back-btn { display: none; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; }
.day-sep { text-align: center; margin: 10px 0; }
.day-sep span { font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 2px 10px; border-radius: 99px; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: min(560px, 78%); padding: 9px 12px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); line-height: 1.45; }
.msg.out .bubble { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); border-bottom-right-radius: 4px; }
.msg.in .bubble { border-bottom-left-radius: 4px; }
.bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-top: 3px; }
.bubble .meta .ch { width: 15px; height: 15px; background: none; }
.bubble .meta .ch .i { width: 12px; height: 12px; }
.bubble .err { display: block; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px 14px; }
.composer-tools { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font: inherit; background: var(--surface-2); color: var(--text); }
.composer .btn.primary { height: 44px; width: 48px; padding: 0; }

/* funil */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 300px; transition: background .15s; }
.kcol.over { background: var(--brand-soft); border-color: var(--brand); }
.kcol-head { display: flex; align-items: center; gap: 8px; }
.kcol-head i { width: 9px; height: 9px; border-radius: 50%; }
.kcol-head b { margin-left: auto; font-size: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 0 8px; }
.kcol-hint { display: block; color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.kcards { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 260px); overflow-y: auto; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px; cursor: grab; box-shadow: var(--shadow); }
.kcard:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.kcard.dragging { opacity: .5; }
.kcard-top { display: flex; align-items: center; gap: 8px; }
.kcard-top strong { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard-info { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.kcard-info span { display: flex; align-items: center; gap: 5px; }
.kcard-info .i { width: 13px; height: 13px; }

/* clientes */
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; padding: 12px; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tbody tr[data-act] { cursor: pointer; }
.table tbody tr[data-act]:hover { background: var(--surface-2); }
.card > .table { margin: 0 -18px -18px; width: calc(100% + 36px); }
.cell-name { display: flex; align-items: center; gap: 10px; }
.cell-name div { display: flex; flex-direction: column; }
.cell-name small { color: var(--muted); font-size: 12px; }
.days { font-weight: 600; }
.days.warn { color: var(--warn); }
.days.bad { color: var(--bad); }
td.next { color: var(--muted); font-size: 13px; }

/* agenda */
.agenda { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 16px; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.day-head strong { text-transform: capitalize; }
.day-head span { color: var(--muted); font-size: 13px; }
.day-head b { margin-left: auto; font-size: 13px; color: var(--ok); }
.appt { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.appt time { font-weight: 600; font-size: 13px; width: 44px; }
.appt-body { flex: 1; min-width: 140px; display: flex; flex-direction: column; cursor: pointer; }
.appt-body span { font-size: 12px; color: var(--muted); }
.appt-actions { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; padding-left: 56px; }
.alert-card { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.alert-card h2 .i { color: var(--warn); }

/* follow-ups */
.task-group.bad .card-head h2 { color: var(--bad); }
.task-group.today .card-head h2 { color: var(--brand); }
.count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 9px; font-size: 12px; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.check { width: 24px; height: 24px; flex: none; border-radius: 7px; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; color: transparent; }
.check:hover { border-color: var(--ok); color: var(--ok); }
.check .i { width: 14px; height: 14px; }
.task-body { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.task-body span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.task time { font-size: 12px; color: var(--muted); }
.task-actions { display: flex; gap: 4px; }
.sugg { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.sugg div { flex: 1; display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.sugg span { font-size: 12px; color: var(--muted); }

/* reativação */
.segments { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.segment { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.segment strong { font-size: 24px; }
.segment span { font-weight: 600; font-size: 13px; }
.segment small { color: var(--muted); font-size: 12px; }
.segment.on { border-color: var(--brand); background: var(--brand-soft); }
.segment.on strong { color: var(--brand); }
.check-all { font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.member-list { max-height: 520px; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.member div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.member small { color: var(--muted); font-size: 12px; }
.member input, .check-all input, .field.inline input { accent-color: var(--brand); width: 16px; height: 16px; }
.preview { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.preview p { margin: 4px 0 0; line-height: 1.45; }

/* integrações / ajustes */
.integ-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.integ-head .ch { width: 40px; height: 40px; border-radius: 11px; }
.integ-head .ch .i { width: 22px; height: 22px; }
.integ-head > div { flex: 1; }
.integ-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.copy-row { display: flex; gap: 6px; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); display: flex; justify-content: flex-end; z-index: 5; }
.templates { display: flex; flex-direction: column; gap: 10px; }
.tpl { display: grid; grid-template-columns: 200px 1fr 36px; gap: 8px; align-items: start; }
.logo-preview { display: flex; align-items: center; gap: 12px; }
.logo-preview img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border); }

/* WhatsApp */
.wa-status { display: flex; flex-direction: column; gap: 4px; background: color-mix(in srgb, #1FAF55 8%, var(--surface)); border: 1px solid color-mix(in srgb, #1FAF55 30%, var(--border)); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.wa-status span { color: var(--muted); }
.wa-status .btn { align-self: flex-start; margin-top: 6px; }
.phone-tag { display: inline-flex; align-items: center; gap: 2px; color: #1FAF55; font-weight: 600; }
.phone-tag .i { width: 11px; height: 11px; }
details.manual { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
details.manual summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* IA */
.ai-btn { color: #7C3AED; border-color: color-mix(in srgb, #7C3AED 35%, var(--border)); background: color-mix(in srgb, #7C3AED 7%, var(--surface)); }
.ai-btn:hover { background: color-mix(in srgb, #7C3AED 14%, var(--surface)); }
.ai-tag { display: inline-flex; align-items: center; gap: 2px; color: #7C3AED; font-weight: 600; }
.ai-tag .i { width: 11px; height: 11px; }
.install-btn { justify-content: flex-start; }
.install-btn[hidden] { display: none; }

/* financeiro */
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.kpi strong.pos { color: var(--ok); }
.kpi strong.neg { color: var(--bad); }
.input.month { width: auto; }
.link { color: var(--brand); font-weight: 500; cursor: pointer; }
.accounts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.account { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.account .i { color: var(--brand); }
.account div { display: flex; flex-direction: column; }
.account span { font-size: 12px; color: var(--muted); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.legend i.pos, .pairbars i.pos { background: var(--ok); }
.legend i.neg, .pairbars i.neg { background: color-mix(in srgb, var(--bad) 75%, var(--surface)); }
.pairbars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.pairbars i { display: block; width: 42%; max-width: 20px; border-radius: 4px 4px 1px 1px; min-height: 2px; }
.columns.pair .col.on span { color: var(--text); font-weight: 600; }
.catrow { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.catrow .bar i { background: color-mix(in srgb, var(--bad) 70%, var(--surface)); }
.catrow b { text-align: right; }
.catrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recon { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; }
.recon > div { flex: 1; min-width: 200px; }
.recon > div[data-act] { cursor: pointer; }
.recon .arrow { color: var(--muted); }
.filters.inline { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.table td.desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.table .num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-select { max-width: 190px; }
.cat-select.empty { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.bank-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.bank-item .i { color: var(--brand); }
.bank-item .btn { margin-left: auto; }
.hours { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.hours .input { width: auto; }
.days { display: flex; gap: 6px; margin-top: 8px; }
.days label { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.days input { accent-color: var(--brand); }

/* gaveta e modal */
.drawer { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 18, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(460px, 100%); background: var(--surface); box-shadow: -8px 0 30px rgba(0, 0, 0, .12); display: flex; flex-direction: column; transform: translateX(30px); transition: transform .2s; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 18px; }
.drawer-head span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.drawer-body { padding: 18px 20px 30px; overflow-y: auto; flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.stat-grid div { background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-grid span { font-size: 11px; color: var(--muted); }
.stat-grid b { font-size: 14px; }
.info-list { margin-top: 16px; display: flex; flex-direction: column; }
.info-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-list > div > span:first-child { color: var(--muted); }
.info-list a { color: var(--brand); }
.mini-task { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.mini-task span { flex: 1; }
.mini-task time { color: var(--muted); font-size: 12px; }
.timeline { list-style: none; padding: 0 0 0 14px; margin: 0 0 20px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 12px 12px; font-size: 13px; display: flex; flex-direction: column; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.stage::before { border-color: var(--brand); }
.timeline li.appt-realizado::before { border-color: var(--ok); background: var(--ok); }
.timeline li.appt-faltou::before { border-color: var(--bad); }
.timeline li.campaign::before { border-color: #D62976; }
.timeline time { font-size: 11px; color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(10, 20, 18, .4); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); max-width: 360px; animation: in .2s; transition: opacity .4s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }
.login { flex: 1; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 32px; }
.login .logo-mark, .login .logo-img { width: 52px; height: 52px; }

/* responsivo */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-side, .grid-side.wide { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: span 2; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 70; left: 0; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .topbar .btn.primary span { display: none; }
  main { padding: 18px 16px 40px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 57px); }
  .inbox .chat { display: none; }
  .inbox.show-chat .chat { display: flex; }
  .inbox.show-chat .inbox-list { display: none; }
  .back-btn { display: inline-grid; }
  .chat-actions .ghost { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .tpl { grid-template-columns: 1fr 36px; }
  .tpl textarea { grid-column: 1; }
  .appt-actions { padding-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .kpi strong { font-size: 21px; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .filters > :first-child { grid-column: auto; }
  .op { flex-wrap: wrap; }
  .filters.inline { grid-template-columns: minmax(0, 1fr); }
  .catrow { grid-template-columns: 100px 1fr 80px; }
  .op-val { margin-left: 44px; }
  .chat-actions .btn span, .chat-actions .btn:not(.ghost) { font-size: 0; gap: 0; }
  .chat-actions .btn .i { width: 16px; height: 16px; }
}

/* ---------- Pacientes ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.xxl { width: 132px; height: 132px; font-size: 42px; border-radius: 20px; }
.filters.patients-f, main[data-view="pacientes"] .filters { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.patient-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.patient-card { display: flex; flex-direction: column; gap: 12px; margin: 0; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.patient-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.pc-top { display: flex; gap: 12px; align-items: center; position: relative; }
.pc-top > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.pc-top strong { font-size: 15px; }
.pc-top small { color: var(--muted); font-size: 12px; }
.pc-alert { position: absolute; top: 0; right: 0; color: var(--warn); }
.patient-card dl { margin: 0; display: grid; gap: 8px; }
.patient-card dl div { display: grid; grid-template-columns: 104px 1fr; gap: 8px; font-size: 13px; }
.patient-card dt { color: var(--muted); }
.patient-card dd { margin: 0; }
.patient-card .days, .ficha .days { display: inline; margin: 0 0 0 4px; font-size: 12px; }
.patient-card footer { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 12px; color: var(--muted); margin-top: auto; }
.next-appt { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 600; }
.next-appt .i { width: 14px; height: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 12px; }
.back-link:hover { color: var(--brand); }
.ficha-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 24px; align-items: start; }
.ficha-photo { grid-row: span 3; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ficha-id h1 { margin: 0 0 4px; font-size: 24px; }
.ficha-id p { margin: 0 0 6px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ficha-id a { color: var(--brand); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ficha-id a .i { width: 15px; height: 15px; }
.ficha-alert { color: var(--warn) !important; font-weight: 600; }
.ficha-stats { grid-template-columns: repeat(4, 1fr); margin: 4px 0 0; }
.ficha-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.ficha-grid h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.ficha-grid h3:first-of-type { margin-top: 0; }
.ficha-dl { margin: 0; display: grid; gap: 6px; }
.ficha-dl div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.ficha-dl div:last-child { border-bottom: 0; }
.ficha-dl dt { color: var(--muted); font-size: 13px; }
.ficha-dl dd { margin: 0; white-space: pre-wrap; }
.tag.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.pre { white-space: pre-wrap; margin: 0; font-size: 14px; }
.center { text-align: center; }
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sessions li { border: 1px solid var(--border); border-left: 4px solid var(--ok, #16A34A); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.sessions li.faltou { border-left-color: var(--bad); opacity: .8; }
.sessions li.none { border: 0; padding: 0; }
.s-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.s-head time { font-size: 12px; color: var(--muted); }
.s-head .btn { margin-left: auto; }
.sessions .ficha-dl div { grid-template-columns: 130px 1fr; font-size: 13px; }
.pain { --v: 0; display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 0 4px; }
.pain i { width: 70px; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); position: relative; overflow: hidden; }
.pain i::after { content: ''; position: absolute; inset: 0; width: calc(var(--v) * 10%); background: hsl(calc(120 - var(--v) * 12) 70% 45%); }
.pain b { font-size: 13px; }
.pain-row { display: flex; align-items: center; flex-wrap: wrap; color: var(--muted); }
.pain-chart { margin-bottom: 14px; }
.pain-chart > div { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin-top: 6px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.pain-chart i { --v: 0; flex: 1; max-width: 34px; height: calc(var(--v) * 10%); min-height: 3px; border-radius: 6px 6px 2px 2px; background: hsl(calc(120 - var(--v) * 12) 65% 50%); position: relative; }
.pain-chart b { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); font-weight: 500; }
.checks { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.checks legend { padding: 0 4px; }
.checks label, .field.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 400; display: flex; }
.checks input, .field.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.form-grid h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin: 10px 0 8px; }
@media (max-width: 900px) {
  .ficha-grid { grid-template-columns: 1fr; }
  .ficha-head { grid-template-columns: 1fr; }
  .ficha-photo { grid-row: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .ficha-photo .avatar.xxl { width: 104px; height: 104px; }
  .ficha-id { text-align: center; }
  .ficha-id p { justify-content: center; }
  .ficha-stats { grid-template-columns: repeat(2, 1fr); }
  .ficha-dl div, .sessions .ficha-dl div { grid-template-columns: 1fr; gap: 2px; }
  .checks { grid-template-columns: 1fr; }
  main[data-view="pacientes"] .filters { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .no-print, .toasts, .drawer, .modal, .scrim { display: none !important; }
  .main-wrap { margin: 0 !important; padding: 0 !important; }
  #main { padding: 0 !important; }
  .card { box-shadow: none; break-inside: avoid; }
  .ficha-grid { grid-template-columns: 1fr; }
  .sessions li { break-inside: avoid; }
  body { background: #fff; }
}

/* ---------- Aniversários ---------- */
.bday-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bday-today { border-color: color-mix(in srgb, #D62976 35%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, #D62976 6%, var(--surface)), var(--surface) 120px); }
.bday-today h2 .i { color: #D62976; }
.bday-list { display: grid; gap: 10px; }
.bday { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.bday.big { padding: 14px 16px; }
.bday.done { opacity: .7; }
.bday-who { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.bday-who > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bday.big .bday-who strong { font-size: 16px; }
.bday-who small { color: var(--muted); font-size: 12px; }
.bday-ok { display: inline-flex; align-items: center; gap: 5px; color: #16A34A; font-weight: 600; font-size: 13px; }
.bday-ok .i { width: 16px; height: 16px; }
.steps-list { padding-left: 18px; margin: 8px 0 12px; display: grid; gap: 6px; }
@media (max-width: 900px) { .bday-grid { grid-template-columns: 1fr; } .bday .btn-row { width: 100%; } }