/* Capita OS design system tokens (Claude Design: "Capita OS Design System") */
:root {
  --blue: #3b82f6; --blue-600: #2563eb; --blue-700: #1d4ed8; --blue-400: #60a5fa;
  --cyan: #06b6d4; --violet: #8b5cf6; --emerald: #10b981; --emerald-400: #34d399;
  --amber: #f59e0b; --amber-400: #fbbf24; --rose: #f43f5e; --rose-400: #fb7185;
  --bg-base: #0b1026; --bg-shell: #080c1e; --surface: #111827; --raised: #16203a; --sunken: #0a0f22; --hover: #17223c;
  --selected: rgba(59, 130, 246, .14);
  --line: rgba(148, 163, 184, .12); --line-2: rgba(148, 163, 184, .20); --line-3: rgba(148, 163, 184, .34); --line-accent: rgba(59, 130, 246, .55);
  --ink: #f8fafc; --ink-2: #94a3b8; --ink-3: #64748b;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-overlay: 0 24px 64px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px rgba(59, 130, 246, .35);
  --ease: cubic-bezier(.2, 0, 0, 1);
  --font: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg-base); color: var(--ink); font: 14px/22px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 32px; line-height: 40px; letter-spacing: -.01em; font-weight: 700; }
h2 { font-size: 24px; line-height: 32px; letter-spacing: -.01em; }
h3 { font-size: 15px; line-height: 22px; }
a { color: var(--blue-400); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; background: var(--raised); padding: 1px 6px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; background: var(--sunken); width: 100%; color: var(--ink);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.7); }
textarea { min-height: 80px; resize: vertical; }
:focus-visible { outline: none; box-shadow: var(--focus); }
label { display: grid; gap: 6px; font-size: 13px; line-height: 18px; color: var(--ink-2); font-weight: 500; }
[hidden] { display: none !important; }
.err { color: var(--rose-400); font-size: 13px; min-height: 1.2em; margin: 0; }
.muted { color: var(--ink-2); }
.num, .r { font-variant-numeric: tabular-nums; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); background: transparent; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background 140ms var(--ease), border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.btn:hover { background: rgba(148, 163, 184, .10); border-color: var(--line-3); text-decoration: none; }
.btn svg.lucide { width: 16px; height: 16px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(37, 99, 235, .35); }
.btn.primary:hover { background: var(--blue-600); box-shadow: 0 0 0 1px rgba(59, 130, 246, .65), 0 0 32px rgba(59, 130, 246, .38); }
.btn.primary:active { background: var(--blue-700); }
.btn.money { background: var(--emerald); border-color: var(--emerald); color: #fff; box-shadow: 0 2px 10px rgba(16, 185, 129, .3); }
.btn.money:hover { background: #059669; }
.btn.danger { color: var(--rose-400); border-color: rgba(244, 63, 94, .38); }
.btn.danger:hover { background: rgba(244, 63, 94, .12); }
.btn.ghost { border-color: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { background: #1e293b; color: var(--ink-3); border-color: #1e293b; box-shadow: none; cursor: not-allowed; }

/* icon tile — the system's recurring motif */
.tile {
  --c: var(--blue); width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.tile.sm { width: 32px; height: 32px; border-radius: 8px; }
.tile.sm svg.lucide { width: 16px; height: 16px; }
.t-cyan { --c: var(--cyan); } .t-violet { --c: var(--violet); } .t-emerald { --c: var(--emerald); } .t-amber { --c: var(--amber); } .t-rose { --c: var(--rose); }

/* login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(60% 50% at 50% 0%, rgba(59, 130, 246, .22), transparent), var(--bg-base); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; width: min(400px, 100%); display: grid; gap: 16px; box-shadow: var(--shadow-overlay); }
.login-card .logo { display: flex; align-items: center; gap: 12px; }
.login-card p { margin: 0; color: var(--ink-2); }
.login-card .btn { height: 42px; }

/* shell */
#shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { background: var(--bg-shell); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff; box-shadow: 0 0 20px rgba(59, 130, 246, .35); }
.mark svg.lucide { width: 18px; height: 18px; }
#nav { display: grid; gap: 4px; }
#nav a { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; border: 1px solid transparent;
  transition: background 140ms var(--ease), color 140ms var(--ease); }
#nav a:hover { background: rgba(148, 163, 184, .10); color: var(--ink); text-decoration: none; }
#nav a.active { background: var(--selected); border-color: var(--line-accent); color: var(--ink); font-weight: 600; box-shadow: 0 0 20px rgba(59, 130, 246, .18); }
#nav a.active svg.lucide { color: var(--blue-400); }
.side-foot { font-size: 12px; color: var(--ink-3); padding: 0 8px; }
.content { min-width: 0; }
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; min-height: 68px; padding: 12px 28px; border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 38, .85); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 5; }
#ws-select { width: auto; min-width: 220px; font-weight: 600; background: var(--surface); }
.period { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-left: auto; }
.period label { display: flex; align-items: center; gap: 8px; }
.period input { width: auto; padding: 6px 10px; }
.presets { display: flex; padding: 3px; gap: 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; }
.presets button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.presets button:hover { color: var(--ink); background: rgba(148, 163, 184, .10); }
main { padding: 24px 28px 60px; display: grid; gap: 16px; max-width: 1480px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 8px; }
.head p { margin: 4px 0 0; color: var(--ink-2); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; box-shadow: var(--shadow-card); }
.panel-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-h h3 { flex: 1; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.notice { display: flex; align-items: center; gap: 10px; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .38); border-radius: 10px; padding: 10px 14px; color: var(--amber-400); }
.notice.info { background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .38); color: var(--blue-400); }

/* hero: money flow — four KPI cards joined by conversion chips */
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-card); display: flex; gap: 14px; }
.kpi::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(160deg, color-mix(in srgb, var(--c, var(--blue)) 12%, transparent) 0%, transparent 62%); }
.kpi > * { position: relative; }
.kpi .lbl { margin: 0; font-size: 13.5px; line-height: 19px; color: var(--ink-2); font-weight: 500; }
.kpi .big { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .sub { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.flow .kpi.win { border-color: rgba(16, 185, 129, .38); box-shadow: var(--shadow-card), 0 0 24px rgba(16, 185, 129, .14); }
.rate { position: absolute; z-index: 2; left: -8px; top: 50%; transform: translate(-50%, -50%); background: var(--raised); border: 1px solid var(--line-3); color: var(--ink);
  border-radius: 99px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); top: 80%; }
.flow-cell { position: relative; display: grid; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.stat .lbl { font-size: 12px; color: var(--ink-2); line-height: 16px; }
.stat .val { font-size: 18px; font-weight: 700; line-height: 24px; font-variant-numeric: tabular-nums; }

.chart-box { position: relative; height: 280px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover td { background: rgba(148, 163, 184, .04); }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
td.good { color: var(--emerald-400); font-weight: 600; }
.scroll { overflow-x: auto; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap;
  background: rgba(100, 116, 139, .14); border: 1px solid rgba(100, 116, 139, .36); color: var(--ink-2); }
.tag.on, .tag.realizado { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .38); color: var(--emerald-400); }
.tag.paused, .tag.agendado { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .38); color: var(--amber-400); }
.tag.cancelado { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .38); color: var(--rose-400); }
.tag.ad { background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .38); color: var(--blue-400); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status .dot { width: 8px; height: 8px; background: var(--ink-3); }
.status.on .dot { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }

/* funnel */
.funnel { display: grid; gap: 8px; }
.fstep { display: grid; grid-template-columns: 130px 1fr 48px; gap: 12px; align-items: center; font-size: 13px; }
.fstep .track { height: 28px; background: var(--sunken); border-radius: 8px; overflow: hidden; }
.fstep .fill { height: 100%; min-width: 4px; border-radius: 8px; background: var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); }
.fstep .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-shell); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 320px; display: flex; flex-direction: column; gap: 8px; transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease); }
.col.over { border-color: var(--line-accent); box-shadow: 0 0 24px rgba(59, 130, 246, .22); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; font-weight: 600; }
.col-h .dot { color: var(--c); box-shadow: 0 0 8px var(--c); }
.col-h .count { margin-left: auto; font-size: 11.5px; padding: 0 8px; border-radius: 99px; background: var(--raised); color: var(--ink-2); }
.card { background: var(--surface); border-radius: 12px; padding: 12px; cursor: grab; border: 1px solid var(--line); display: grid; gap: 6px; text-align: left; width: 100%; color: var(--ink);
  transition: border-color 140ms var(--ease), background 140ms var(--ease); }
.card:hover { border-color: var(--line-3); background: var(--hover); }
.card .who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--blue), var(--violet)); }
.card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .msg { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.card .meta .tag { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* forms + modal */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; align-items: end; }
.form .wide { grid-column: 1 / -1; }
dialog { border: 1px solid var(--line-2); border-radius: 16px; padding: 0; width: min(660px, calc(100vw - 32px)); max-height: 90vh; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgba(5, 8, 20, .68); backdrop-filter: blur(4px); }
dialog[open] { animation: rise 200ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
#modal-body { padding: 24px; display: grid; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.chat { background: var(--sunken); border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 320px; overflow-y: auto; display: grid; gap: 8px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 18px 18px 18px 6px; background: var(--raised); font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.bubble.me { justify-self: end; border-radius: 18px 18px 6px 18px; background: var(--blue-600); }
.bubble time { display: block; font-size: 10.5px; color: var(--ink-2); margin-top: 2px; }
.bubble.me time { color: #c7d7fe; }
.qr { display: grid; place-items: center; gap: 12px; padding: 12px; }
.qr img { width: 264px; height: 264px; image-rendering: pixelated; background: #fff; padding: 12px; border-radius: 14px; }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty .tile { width: 52px; height: 52px; border-radius: 14px; }
.empty .tile svg.lucide { width: 24px; height: 24px; stroke-width: 1.5; }
.empty h2 { color: var(--ink); font-size: 18px; line-height: 26px; }

/* anúncios */
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.insight { display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-card); }
.insight > div { display: grid; min-width: 0; }
.insight .k { font-size: 12px; color: var(--ink-3); }
.insight b { font-size: 15px; line-height: 21px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.insight small { color: var(--ink-2); }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ad-card { display: flex; flex-direction: column; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ad-media { position: relative; aspect-ratio: 1 / 1; background: var(--sunken); display: grid; place-items: center; overflow: hidden; }
.ad-media img, .ad-media video { width: 100%; height: 100%; object-fit: cover; }
.ad-ph svg.lucide { width: 36px; height: 36px; color: var(--ink-3); }
.ad-type { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: rgba(5, 8, 20, .7); font-size: 11.5px; font-weight: 600; backdrop-filter: blur(6px); }
.ad-type svg.lucide { width: 13px; height: 13px; }
.ad-play { position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(59, 130, 246, .9); color: #fff; box-shadow: 0 0 30px rgba(59, 130, 246, .5); }
.ad-play svg.lucide { width: 26px; height: 26px; margin-left: 3px; }
.ad-body { padding: 14px; display: grid; gap: 6px; flex: 1; align-content: start; }
.ad-title { display: flex; gap: 8px; align-items: start; justify-content: space-between; }
.ad-title b { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ad-copy { margin: 2px 0; font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ad-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.ad-stats div { display: grid; }
.ad-stats dt { font-size: 11.5px; color: var(--ink-3); }
.ad-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ad-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.ad-foot a { display: inline-flex; align-items: center; gap: 5px; }
.ad-foot svg.lucide { width: 14px; height: 14px; }
.roas { font-weight: 700; color: var(--ink-2); }
.roas.good { color: var(--emerald-400); }
.segbars { display: grid; gap: 14px; }
.segbar { display: grid; gap: 5px; }
.segbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.segbar .track { height: 8px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.segbar .fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 10px rgba(6, 182, 212, .35); }
.segbar small { color: var(--ink-3); font-size: 12px; }
table.seg { margin-top: 12px; }

/* form editor */
.form-editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.fe-left { display: grid; gap: 16px; min-width: 0; }
.fe-right { position: sticky; top: 92px; }
.phone { width: 360px; height: 720px; max-height: calc(100vh - 140px); border-radius: 36px; border: 10px solid #000; overflow: hidden; background: #e9ebee; box-shadow: var(--shadow-overlay), 0 0 0 1px var(--line-2); margin: 0 auto 8px; }
.phone iframe { width: 100%; height: 100%; border: 0; }
.fsteps { display: grid; gap: 12px; }
.fstep-card { display: grid; gap: 10px; padding: 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.fstep-top { display: flex; align-items: center; gap: 8px; }
.fstep-top select { width: auto; }
@media (max-width: 1200px) { .form-editor { grid-template-columns: 1fr; } .fe-right { position: static; } }

.seg-tabs { display: inline-flex; padding: 3px; gap: 3px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.seg-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink-2); padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.seg-tabs button svg.lucide { width: 16px; height: 16px; }
.seg-tabs button.on { background: var(--selected); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-accent); }
.theme-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.preset { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--line-2); cursor: pointer; font-weight: 600; font-size: 13px; }
.preset span { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.preset:hover { box-shadow: 0 0 0 2px var(--blue); }

.origin { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--c); }
.origin svg.lucide { width: 13px; height: 13px; }
.origins { display: grid; gap: 8px; }
.origins > div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.origins .origin { font-size: 13px; }

.vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12.5px; }
.vars button { border: 1px solid var(--line-2); background: var(--sunken); color: var(--cyan); font: 500 12px 'JetBrains Mono', monospace; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.vars button:hover { border-color: var(--cyan); }
.wa-prev { background: #0b141a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23ffffff10'/%3E%3C/svg%3E"); border-radius: 12px; padding: 14px; }
.bubble-wa { max-width: 85%; margin-left: auto; background: #005c4b; color: #e9edef; padding: 8px 10px; border-radius: 8px 0 8px 8px; font-size: 13.5px; line-height: 19px; }

/* beta + report */
.beta { margin-left: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 2px 7px; border-radius: 99px; color: var(--violet); background: rgba(139, 92, 246, .14); border: 1px solid rgba(139, 92, 246, .4); }
.report-btn { margin-top: auto; justify-content: flex-start; color: var(--ink-2); border-color: var(--line); }
.report-btn svg.lucide { width: 16px; height: 16px; }
.side-foot { margin-top: 10px !important; }
.capi { font-size: 11px; color: var(--ink-3); }
.capi.ok { color: var(--emerald-400); }
#rep-txt { font-size: 13.5px; line-height: 20px; }

/* header helpers (desktop) */
.top .menu-btn, .tabbar, .scrim { display: none; }
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.head-tools input { flex: 1 1 200px; min-width: 0; width: auto; }

/* ---------- custom controls (ui.js) ---------- */
.ui-trigger { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--sunken);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease); }
.ui-trigger:hover { border-color: var(--line-3); }
.ui-trigger:focus-visible, .ui-trigger[aria-expanded="true"] { outline: none; border-color: var(--blue); box-shadow: var(--focus); }
.ui-trigger .ui-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-trigger svg { flex: none; color: var(--ink-3); }
.ui-trigger.empty .ui-val { color: var(--ink-3); }
.ui-trigger:disabled { opacity: .6; cursor: not-allowed; }
.ui-select svg { order: 2; transition: transform 140ms var(--ease); }
.ui-select[aria-expanded="true"] svg { transform: rotate(180deg); }
.top .ui-select { width: auto; min-width: 220px; font-weight: 600; background: var(--surface); }
.period .ui-date { width: 150px; padding: 6px 10px; min-height: 34px; }
.stage-pill .ui-select { border: 0; background: none; box-shadow: none !important; padding: 0; min-height: 0; width: auto; font-weight: 600; font-size: inherit; color: var(--ink); }
.stage-pill > svg.lucide { display: none; }
.stage-pill .ui-select svg { width: 14px; height: 14px; color: var(--ink-2); }
.ui-file { width: auto; color: var(--ink-2); }
.ui-file svg { color: var(--blue-400); }
.ui-color { width: auto; min-width: 140px; }
.ui-sw { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-3); flex: none; }
.ui-pop { position: fixed; z-index: 2000; background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-overlay); padding: 6px; animation: rise 140ms var(--ease); }
.ui-pop-list { max-height: 300px; display: flex; flex-direction: column; }
.ui-list { overflow-y: auto; display: grid; gap: 1px; }
.ui-filter { margin: 2px 2px 6px; width: auto; }
.ui-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.ui-opt:hover, .ui-opt:focus-visible { background: rgba(148, 163, 184, .12); outline: none; }
.ui-opt.on { color: var(--blue-400); font-weight: 600; }
.ui-opt svg { color: var(--blue-400); }
.ui-times { grid-template-columns: repeat(4, 1fr); width: 260px; }
.ui-times .ui-opt { justify-content: center; padding: 8px 4px; font-variant-numeric: tabular-nums; }
.ui-times .ui-opt.on { background: var(--blue); color: #fff; }
.ui-pop-cal { width: 286px; padding: 12px; }
.ui-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ui-cal-head b { font-size: 14px; }
.ui-nav { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; }
.ui-nav:hover { background: rgba(148, 163, 184, .12); color: var(--ink); }
.ui-week, .ui-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.ui-week span { font-size: 11px; color: var(--ink-3); font-weight: 600; padding: 4px 0; }
.ui-day { aspect-ratio: 1; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.ui-day:hover { background: rgba(148, 163, 184, .14); }
.ui-day:focus-visible { outline: 2px solid var(--blue-400); outline-offset: -2px; }
.ui-day:focus:not(:focus-visible) { outline: none; }
.ui-day.today { box-shadow: inset 0 0 0 1px var(--line-accent); color: var(--blue-400); }
.ui-day.on { background: var(--blue); color: #fff; box-shadow: 0 0 12px rgba(59, 130, 246, .45); }
.ui-day:disabled { color: var(--ink-3); opacity: .4; cursor: default; background: none; }
.ui-cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ui-cal-foot button { border: 0; background: none; color: var(--blue-400); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.ui-cal-foot button:hover { background: rgba(59, 130, 246, .12); }
.ui-pop-color { width: 236px; padding: 10px; }
.ui-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ui-palette button { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line-3); cursor: pointer; }
.ui-palette button.on { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--blue); }
.ui-hex { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; }
.ui-hex input { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; padding: 6px 8px; }
.ui-audio { display: flex; align-items: center; gap: 10px; min-width: 230px; width: 100%; }
.ui-play { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--emerald); color: #fff; cursor: pointer; }
.msg.out .ui-play { background: #fff; color: var(--blue-700); }
.ui-track { position: relative; flex: 1; height: 4px; border-radius: 4px; background: rgba(148, 163, 184, .3); cursor: pointer; }
.ui-track i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--emerald-400); }
.msg.out .ui-track i { background: #fff; }
.ui-track b { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--emerald-400); }
.msg.out .ui-track b { background: #fff; }
.ui-time { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 32px; }
.ui-speed { border: 0; border-radius: 99px; padding: 2px 7px; font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, .25); color: var(--ink); cursor: pointer; }
.m-audio > svg.lucide { display: none; }
/* checkbox, number spinners, scrollbars */
input[type="checkbox"]:not(.switch-row input) { appearance: none; width: 18px; height: 18px; flex: none; border: 1.5px solid var(--line-3); border-radius: 5px; background: var(--sunken); cursor: pointer; display: inline-grid; place-items: center; padding: 0; transition: background 140ms var(--ease), border-color 140ms var(--ease); }
input[type="checkbox"]:not(.switch-row input):checked { background: var(--blue); border-color: var(--blue); }
input[type="checkbox"]:not(.switch-row input):checked::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .28) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .25); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(148, 163, 184, .4); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(59, 130, 246, .35); }

/* states: 404, sem acesso, erro, carregando, offline */
.state { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 64px 20px; }
.state .code { font-size: 88px; font-weight: 800; line-height: 1; letter-spacing: -.04em; background: linear-gradient(135deg, var(--blue-400), var(--cyan)); -webkit-background-clip: text; color: transparent; }
.state .tile { width: 56px; height: 56px; border-radius: 16px; }
.state .tile svg.lucide { width: 26px; height: 26px; }
.state p { margin: 0 0 8px; color: var(--ink-2); max-width: 420px; }
.loading { display: grid; gap: 16px; }
.sk { height: 110px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); animation: pulse-sk 1.2s ease-in-out infinite alternate; }
.sk:first-child { height: 40px; width: 40%; }
@keyframes pulse-sk { to { opacity: .45; } }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 3000; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px 12px; background: var(--amber); color: #1c1203; font-size: 13px; font-weight: 600; }
.offline svg.lucide { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; color: var(--blue-400); font: inherit; font-size: 13.5px; cursor: pointer; padding: 4px; justify-self: center; }
.link-btn:hover { text-decoration: underline; }
.login-card .legal { text-align: center; font-size: 12px; color: var(--ink-3); }
.login-card .legal a, .side-foot a { color: var(--ink-3); }
.ok-msg { color: var(--emerald-400) !important; font-weight: 500; }
.user-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row .btn:first-of-type { margin-left: auto; }

/* onboarding tour */
.tour { position: fixed; inset: 0; z-index: 2500; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(5, 8, 20, .74), 0 0 0 2px var(--blue), 0 0 32px rgba(59, 130, 246, .55); transition: all 420ms cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.tour-cursor { position: fixed; top: 0; left: 0; z-index: 2; transition: transform 650ms cubic-bezier(.2, .8, .2, 1), opacity 200ms; pointer-events: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.tour-ripple { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; margin: -5px; border-radius: 50%; border: 2px solid var(--cyan); opacity: 0; }
.tour-cursor.click .tour-ripple { animation: ripple 600ms ease-out; }
@keyframes ripple { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(4); opacity: 0; } }
.tour-card { position: fixed; z-index: 3; width: 360px; max-width: calc(100vw - 32px); background: var(--raised); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-overlay); animation: rise 260ms var(--ease); }
.tour-card.center { top: 50%; left: 50%; transform: translate(-50%, -50%); width: 420px; }
.tour-card.sheet { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); width: auto; max-width: none; }
.tour-card h3 { font-size: 18px; line-height: 25px; margin: 4px 0 8px; }
.tour-card p { margin: 0; color: var(--ink-2); line-height: 21px; }
.tour-step { font-size: 12px; font-weight: 600; color: var(--blue-400); }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.tour-dots { display: flex; justify-content: center; gap: 5px; margin-top: 14px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--line-3); transition: width 200ms var(--ease); }
.tour-dots i.on { width: 18px; background: var(--blue); }
.tour-todo { display: grid; gap: 8px; margin-top: 14px; }
.tour-todo a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.tour-todo a:hover { border-color: var(--line-accent); }
.tour-todo span { display: grid; }
.tour-todo small { color: var(--ink-3); font-size: 12px; }
.tour-todo svg.lucide { color: var(--blue-400); }

/* toasts + ask dialog */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow-overlay); animation: rise 200ms var(--ease); font-size: 13.5px; }
.toast.out { opacity: 0; transform: translateY(4px); transition: all 200ms var(--ease); }
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { border-color: var(--line-accent); }
.toast > div { flex: 1; min-width: 0; display: grid; }
.toast > div span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast.t-error { border-color: rgba(244, 63, 94, .45); }
.toast.t-error .tile { --c: var(--rose); }
.toast.t-success .tile { --c: var(--emerald); }
.toast.t-message { border-color: rgba(16, 185, 129, .4); }
.toast .avatar { width: 38px; height: 38px; }
.toast .x { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px; display: grid; }
.toast .x svg.lucide { width: 16px; height: 16px; }
#ask { width: min(420px, calc(100vw - 32px)); }
.ask-body { padding: 22px; display: grid; gap: 16px; }
.ask-body p { margin: 0; font-size: 15px; }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn.danger-solid { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn.danger-solid:hover { background: #e11d48; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--emerald); color: #04130d; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.err-pre { white-space: pre-wrap; font-size: 11.5px; color: var(--ink-2); background: var(--sunken); padding: 10px; border-radius: 8px; max-height: 300px; overflow: auto; }
details summary { cursor: pointer; }

/* whatsapp settings */
.switches { display: grid; gap: 4px; }
.switch-row { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--ink); }
.switch-row > span:first-child { flex: 1; display: grid; }
.switch-row small { color: var(--ink-3); font-weight: 400; }
.switch-row input { display: none; }
.sw { width: 40px; height: 22px; flex: none; border-radius: 99px; background: #1e293b; border: 1px solid var(--line-2); position: relative; transition: background 140ms var(--ease); }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform 200ms var(--ease), background 140ms var(--ease); }
.switch-row input:checked + .sw { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 12px rgba(59, 130, 246, .35); }
.switch-row input:checked + .sw::after { transform: translateX(18px); background: #fff; }
.switches .btn { margin-top: 12px; justify-self: start; }
.switches label.wide { margin: 4px 0 8px; }
.profile-row { display: flex; align-items: center; gap: 16px; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; }
.poll-opts { display: grid; gap: 8px; }
.fwd-list { display: grid; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.fwd-list .conv .avatar { width: 40px; height: 40px; }

/* conversas — WhatsApp-Web-like inbox in Capita OS skin */
main:has(.inbox) { max-width: none; padding-bottom: 16px; }
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 0; height: calc(100vh - 108px); min-height: 540px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-card); }
.inbox.with-side.open { grid-template-columns: 340px minmax(0, 1fr) 300px; }
@media (max-width: 1500px) { .inbox.with-side.open { grid-template-columns: 300px minmax(0, 1fr) 280px; } }
.inbox > * { min-height: 0; min-width: 0; }
.icon-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); border-radius: 10px; cursor: pointer; transition: background 140ms var(--ease), color 140ms var(--ease); }
.icon-btn:hover { background: rgba(148, 163, 184, .12); color: var(--ink); }
.icon-btn.on { color: var(--blue-400); background: var(--selected); }
.icon-btn svg.lucide { width: 20px; height: 20px; }
.avatar { object-fit: cover; }
img.avatar { background: var(--raised); }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; }
.avatar.grp { background: linear-gradient(135deg, #0891b2, #3b82f6); }
.avatar svg.lucide { width: 55%; height: 55%; }
.conv-act { position: absolute; right: 10px; top: 32px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--ink-2); opacity: 0; background: var(--hover); }
.conv:hover .conv-act { opacity: 1; }
.conv .pin { color: var(--ink-3); flex: none; display: inline-flex; }
.conv .pin svg.lucide { width: 14px; height: 14px; }
.conv .st.muted { color: var(--ink-3); }
.conv .st svg.lucide { width: 12px; height: 12px; }
.ib-list { position: relative; }
.sender { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.m-poll { display: grid; gap: 6px; min-width: 240px; padding: 4px 2px; }
.m-poll .poll-k { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.m-poll .poll-k svg.lucide { width: 14px; height: 14px; }
.m-poll .opt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, .18); font-size: 13.5px; }
.m-poll .opt svg.lucide { width: 16px; height: 16px; color: var(--ink-2); }
.m-poll small { color: var(--ink-3); font-size: 11px; }
.m-cta { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 6px; padding: 6px; border: 0; border-top: 1px solid var(--line-2); background: none; color: var(--blue-400); font-weight: 600; cursor: pointer; }
.m-cta svg.lucide { width: 16px; height: 16px; }
.attach-pop { min-width: 210px; }

.ib-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg-shell); }
.ib-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.ib-top h2 { font-size: 20px; line-height: 28px; }
.ib-search { position: relative; margin: 4px 14px 10px; }
.ib-search input { padding-left: 40px; height: 40px; border-radius: 10px; background: var(--surface); }
.ib-search .s-ic { position: absolute; left: 12px; top: 10px; color: var(--ink-3); }
.chips { display: flex; gap: 6px; padding: 0 14px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line-2); background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 500; padding: 4px 12px; border-radius: 99px; cursor: pointer; }
.chips button:hover { color: var(--ink); border-color: var(--line-3); }
.chips button.on { background: var(--selected); border-color: var(--line-accent); color: var(--blue-400); }
.ib-items { overflow-y: auto; overflow-x: hidden; flex: 1; }
.conv { display: flex; gap: 12px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); align-items: center; position: relative; }
.conv::after { content: ''; position: absolute; left: 76px; right: 0; bottom: 0; border-bottom: 1px solid var(--line); }
.conv:hover { background: rgba(148, 163, 184, .06); }
.conv.active { background: var(--selected); }
.conv .avatar { width: 50px; height: 50px; font-size: 15px; }
.conv .body { min-width: 0; flex: 1; display: grid; gap: 1px; }
.conv .row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conv .row > * { min-width: 0; }
.conv .name { font-weight: 600; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .time { font-size: 11.5px; color: var(--ink-3); flex: none; }
.conv.unread .time { color: var(--emerald-400); font-weight: 600; }
.conv .msg { display: flex; align-items: center; gap: 3px; font-size: 13px; color: var(--ink-2); flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conv.unread .msg { color: var(--ink); }
.conv .badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--emerald); color: #04130d; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.conv .meta { gap: 10px; font-size: 11px; margin-top: 2px; }
.conv .st { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); flex: none; }
.conv .st .dot, .stage-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.conv .camp { display: inline-flex; align-items: center; gap: 4px; color: var(--blue-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .camp svg.lucide { width: 12px; height: 12px; }
.tk { display: inline-flex; color: var(--ink-3); flex: none; }
.tk svg.lucide { width: 15px; height: 15px; }
.tk.read { color: #53bdeb; }

.ib-thread { display: flex; flex-direction: column; position: relative; background: #0a0f22; }
.ib-welcome { margin: auto; display: grid; justify-items: center; gap: 10px; text-align: center; max-width: 380px; padding: 24px; color: var(--ink-2); }
.ib-welcome .tile { width: 64px; height: 64px; border-radius: 18px; }
.ib-welcome .tile svg.lucide { width: 30px; height: 30px; stroke-width: 1.5; }
.ib-welcome h2 { color: var(--ink); font-size: 20px; }
.ib-welcome p { margin: 0; }
.ib-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 64px; z-index: 2; }
.ib-head .avatar { width: 42px; height: 42px; }
.ib-head .back { display: none; }
.ib-head .who { flex: 1; min-width: 0; display: grid; }
.ib-head .who strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-head .who small { color: var(--ink-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-pill { position: relative; display: inline-flex; flex-direction: row; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.stage-pill select { appearance: none; border: 0; background: none; padding: 0; width: auto; font-weight: 600; cursor: pointer; box-shadow: none !important; }
.stage-pill select option { background: var(--raised); }
.stage-pill svg.lucide { width: 14px; height: 14px; color: var(--ink-2); pointer-events: none; }

.ib-msgs { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 6% 18px; display: flex; flex-direction: column;
  background-image: radial-gradient(rgba(148, 163, 184, .06) 1px, transparent 1px); background-size: 22px 22px; }
.mrow { display: contents; }
.day { align-self: center; font-size: 12px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 3px 12px; border-radius: 8px; margin: 12px 0 8px; box-shadow: var(--shadow-card); }
.msg { display: flex; margin-top: 2px; }
.msg.first { margin-top: 10px; }
.msg.out { justify-content: flex-end; }
.bubble2 { position: relative; max-width: min(65%, 560px); padding: 6px 9px 8px; border-radius: 10px; background: var(--raised); color: var(--ink); font-size: 14px; line-height: 20px; box-shadow: 0 1px 1px rgba(0, 0, 0, .3); word-break: break-word; }
.msg.out .bubble2 { background: #1d4ed8; background: linear-gradient(180deg, #2563eb, #1e4fd6); }
.msg.in.first .bubble2 { border-top-left-radius: 0; }
.msg.out.first .bubble2 { border-top-right-radius: 0; }
.msg.in.first .bubble2::before, .msg.out.first .bubble2::before { content: ''; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.in.first .bubble2::before { left: -8px; background: var(--raised); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg.out.first .bubble2::before { right: -8px; background: #2563eb; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble2 .txt { white-space: pre-wrap; }
.bubble2 .txt a { color: #93c5fd; text-decoration: underline; }
.bubble2 .mt { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -4px 12px; font-size: 11px; color: rgba(248, 250, 252, .6); position: relative; top: 2px; }
.msg.out .bubble2 .mt { color: rgba(219, 234, 254, .75); }
.msg.out .tk { color: rgba(219, 234, 254, .75); }
.msg.out .tk.read { color: #7dd3fc; }
.bubble2.media { padding: 4px; }
.bubble2.media .txt { display: block; padding: 4px 5px 0; }
.bubble2.media .mt { margin-right: 4px; }
.bubble2.media:not(:has(.txt)) .mt { position: absolute; right: 8px; bottom: 8px; margin: 0; padding: 0 6px; border-radius: 8px; background: rgba(0, 0, 0, .45); color: #fff; }
.bubble2.sticker { background: none !important; box-shadow: none; }
.bubble2.sticker::before { display: none; }
.m-img { display: block; }
.m-img img, .m-video { display: block; max-width: 100%; width: 330px; max-height: 360px; object-fit: cover; border-radius: 7px; background: var(--sunken); }
.m-sticker { width: 150px; height: 150px; object-fit: contain; }
.m-audio { display: flex; align-items: center; gap: 8px; width: 270px; max-width: 100%; padding: 2px 0; }
.m-audio audio { height: 36px; flex: 1; min-width: 0; width: 100%; }
.m-audio > svg.lucide { color: var(--emerald-400); }
.m-doc { display: flex; align-items: center; gap: 10px; padding: 8px; min-width: 240px; border-radius: 8px; background: rgba(0, 0, 0, .18); color: inherit; text-decoration: none !important; }
.m-doc span:not(.tile) { display: grid; flex: 1; min-width: 0; }
.m-doc b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-doc small { color: var(--ink-2); text-transform: uppercase; font-size: 11px; }
.m-miss { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-style: italic; }
.deleted { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-style: italic; }
.deleted svg.lucide { width: 15px; height: 15px; }
.quote { display: block; width: 100%; text-align: left; margin-bottom: 4px; padding: 6px 10px; border: 0; border-left: 4px solid var(--cyan); border-radius: 6px; background: rgba(0, 0, 0, .22); color: var(--ink-2); font-size: 12.5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.msg.out .quote { border-left-color: #93c5fd; color: #dbeafe; }
.m-act { position: absolute; top: 3px; right: 3px; width: 26px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 6px; cursor: pointer; color: var(--ink); opacity: 0; background: radial-gradient(circle at 70% 30%, rgba(0, 0, 0, .35), transparent 80%); transition: opacity 140ms var(--ease); }
.bubble2:hover .m-act, .m-act:focus-visible { opacity: 1; }
.m-act svg.lucide { width: 16px; height: 16px; }
.reacts { position: absolute; bottom: -14px; left: 8px; display: inline-flex; gap: 1px; padding: 1px 6px; border-radius: 99px; background: var(--raised); border: 1px solid var(--line-2); font-size: 13px; line-height: 18px; z-index: 1; }
.msg.out .reacts { left: auto; right: 8px; }
.msg:has(.reacts) { margin-bottom: 14px; }
.bubble2.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 30% { box-shadow: 0 0 0 3px rgba(6, 182, 212, .7); } }

.pop { position: absolute; z-index: 20; min-width: 200px; padding: 6px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow-overlay); display: grid; animation: rise 140ms var(--ease); }
.pop > button, .pop > a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--ink); font-size: 13.5px; text-align: left; text-decoration: none; }
.pop > button:hover, .pop > a:hover { background: rgba(148, 163, 184, .12); }
.pop > .danger { color: var(--rose-400); }
.pop .quick { display: flex; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.pop .quick button { border: 0; background: none; font-size: 22px; width: 36px; height: 36px; border-radius: 99px; cursor: pointer; transition: transform 90ms var(--ease); }
.pop .quick button:hover { background: rgba(148, 163, 184, .14); }
.pop .quick button.on { background: var(--selected); }
.emoji-pop { left: 12px; bottom: 70px; grid-template-columns: repeat(8, 38px); }
.emoji-pop button { font-size: 22px; height: 38px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.emoji-pop button:hover { background: rgba(148, 163, 184, .14); }
.attach-pop { left: 54px; bottom: 70px; }

.ib-compose { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px; z-index: 2; }
.c-row { display: flex; align-items: end; gap: 6px; }
.c-row textarea, .c-row input { flex: 1; min-height: 42px; max-height: 140px; resize: none; border-radius: 10px; padding: 10px 14px; line-height: 20px; }
.send-btn { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; background: var(--blue); box-shadow: 0 2px 10px rgba(37, 99, 235, .35); transition: background 140ms var(--ease); }
.send-btn:hover { background: var(--blue-600); }
.send-btn svg.lucide { width: 20px; height: 20px; }
.reply-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 8px 8px 12px; border-left: 4px solid var(--cyan); border-radius: 8px; background: var(--sunken); }
.reply-bar div { flex: 1; min-width: 0; display: grid; font-size: 12.5px; }
.reply-bar b { color: var(--cyan); }
.reply-bar span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec { display: flex; align-items: center; gap: 12px; height: 42px; }
.rec .muted { flex: 1; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 10px var(--rose); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .35; } }
#rec-t { font-variant-numeric: tabular-nums; font-weight: 600; }
.drop-hint { display: none; position: absolute; inset: 64px 0 0; z-index: 5; place-items: center; align-content: center; gap: 10px; background: rgba(11, 16, 38, .88); border: 2px dashed var(--blue); border-radius: 0 0 14px 0; color: var(--blue-400); font-weight: 600; }
.dragging .drop-hint { display: grid; }
.drop-hint svg.lucide { width: 32px; height: 32px; }
.file-prev { display: grid; place-items: center; background: var(--sunken); border-radius: 12px; padding: 12px; min-height: 160px; }
.file-prev img, .file-prev video { max-width: 100%; max-height: 50vh; border-radius: 8px; }

.ib-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 18px; display: grid; gap: 12px; align-content: start; background: var(--bg-shell); }
.side-close { display: none; justify-self: end; }
.side-hero { display: grid; justify-items: center; gap: 4px; padding: 6px 0 10px; text-align: center; }
.side-hero h3 { margin-top: 8px; font-size: 17px; }
.side-card { display: grid; gap: 6px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.side-card .k { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.side-card .k svg.lucide { width: 14px; height: 14px; }
.side-card textarea { min-height: 70px; }
.side-card .btn { margin-top: 4px; }
.sale-row { display: flex; align-items: center; gap: 8px; }
.sale-row span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
  .inbox, .inbox.with-side { grid-template-columns: 320px minmax(0, 1fr) 0; }
  .ib-side { display: none; }
  .inbox { position: relative; }
  .inbox.side-mobile .ib-side { display: grid; position: absolute; inset: 0 0 0 auto; width: min(380px, 100%); z-index: 8; box-shadow: var(--shadow-overlay); }
  .side-close { display: grid; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-cell:nth-child(3) .rate { display: none; }
}
@media (max-width: 900px) {
  /* app layout: drawer + bottom tab bar */
  #shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; height: 100dvh; z-index: 40; transform: translateX(-102%); transition: transform 240ms var(--ease); overflow-y: auto; padding-bottom: 24px; }
  body.nav-open .side { transform: none; box-shadow: var(--shadow-overlay); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(5, 8, 20, .6); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease); }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid !important; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(8, 12, 30, .94); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--ink-3); font: 500 11px var(--font); text-decoration: none; cursor: pointer; }
  .tabbar svg.lucide { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--blue-400); }
  .tabbar .nav-badge { position: absolute; top: 0; left: 55%; margin: 0; min-width: 18px; height: 18px; font-size: 10px; }
  .content { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  /* compact header */
  .top { position: sticky; padding: 8px 12px; gap: 8px; min-height: 0; }
  #ws-select { flex: 1; min-width: 0; width: auto; }
  #print span { display: none; }
  #print { width: 40px; padding: 0; }
  .period { order: 3; width: 100%; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .presets { grid-column: 1 / -1; display: flex; flex-flow: row nowrap; overflow-x: auto; scrollbar-width: none; }
  .presets::-webkit-scrollbar { display: none; }
  .presets button { flex: 1 0 auto; white-space: nowrap; }
  .period label { min-width: 0; font-size: 12px; }
  .period input, .period .ui-date { width: 100%; min-width: 0; padding: 6px 8px; }
  .top .ui-select { flex: 1; min-width: 0; width: auto; }
  main { padding: 16px 12px 24px; gap: 14px; }
  .head h2 { font-size: 20px; line-height: 28px; }
  .head-tools { width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; gap: 10px; }
  .stat .tile { display: none; }
  .flow { grid-template-columns: 1fr 1fr; gap: 10px; }
  .rate { display: none; }
  .kpi { padding: 14px; flex-direction: column; gap: 8px; }
  .kpi .tile { width: 32px; height: 32px; border-radius: 8px; }
  .kpi .tile svg.lucide { width: 16px; height: 16px; }
  .kpi .lbl { font-size: 12.5px; line-height: 17px; }
  .kpi .big { font-size: 22px; line-height: 28px; margin-top: 2px; }
  .kpi .sub { font-size: 11.5px; }
  .insights { grid-template-columns: 1fr; }
  .ad-grid { grid-template-columns: 1fr; }
  .fstep { grid-template-columns: 96px 1fr 32px; }
  .panel { padding: 16px; }
  .notice { align-items: flex-start; flex-wrap: wrap; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  #modal-body { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .form { grid-template-columns: 1fr; }
  /* conversas: one pane at a time, full height above the tab bar */
  main:has(.inbox) { padding: 0; }
  .inbox, .inbox.with-side, .inbox.with-side.open { grid-template-columns: 1fr; height: calc(100dvh - 128px - 68px - env(safe-area-inset-bottom)); border-radius: 0; border-left: 0; border-right: 0; }
  body[data-page="conversas"] .period { display: none; }
  body[data-page="conversas"] .inbox, body[data-page="conversas"] .inbox.open { height: calc(100dvh - 57px - 68px - env(safe-area-inset-bottom)); }
  .inbox.open .ib-list, .inbox:not(.open) .ib-thread { display: none; }
  .ib-head .back { display: grid; }
  .ib-head { gap: 6px; padding: 8px 10px; }
  .ib-head .avatar { width: 36px; height: 36px; }
  .ib-head .who { min-width: 70px; }
  .ib-head .who small { display: none; }
  .ib-head #sell-top { display: none; }
  .stage-pill { padding: 0 8px; font-size: 12px; height: 32px; gap: 5px; }
  .stage-pill select { max-width: 104px; text-overflow: ellipsis; }
  .fstep-top { flex-wrap: wrap; }
  .fstep-top select { flex: 1; min-width: 0; }
  .ib-msgs { padding: 12px; }
  .bubble2 { max-width: 85%; }
  .m-img img, .m-video { width: 100%; }
  /* funil: swipe between stages */
  .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  /* formulário editor */
  .fe-right { order: -1; }
  .phone { width: min(320px, 100%); height: 560px; border-width: 8px; border-radius: 30px; }
  .fstep-card .c-row { flex-wrap: wrap; }
  .fstep-card input[type="number"] { width: 70px !important; }
  .profile-row { flex-wrap: wrap; }
  .switch-row small { font-size: 12px; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; }
}
@media (max-width: 560px) {
  .fstep { grid-template-columns: 100px 1fr 36px; }
}
@media print {
  :root { color-scheme: light; }
  .side, .no-print, .presets, #ws-select { display: none !important; }
  #shell { display: block; }
  .top { position: static; border: 0; backdrop-filter: none; }
  body, html { background: var(--bg-base); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .panel, .flow, .kpis { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
