:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e3e8ef;
  --line-2: #eef1f5;
  /* same palette as the store site (maistechglobal.com.br): #334260 header blue, brand orange, Montserrat */
  --text: #26324a;
  --muted: #6b7686;
  --faint: #9aa4b2;
  --side: #334260;
  --side-2: #415278;
  --side-text: #c3cbdb;
  --accent: #ec6a2c;
  --accent-soft: #fdeee4;
  --green: #1f9d55;
  --green-soft: #e3f6ea;
  --red: #e5484d;
  --red-soft: #fdecec;
  --amber: #d98a10;
  --amber-soft: #fff4e0;
  --bubble-in: #ffffff;
  --bubble-out: #e3eaf6;
  --note: #fff7d6;
  --chat-bg: #eef1f6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 Montserrat, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1000px 520px at 15% 0%, #4a5f8a 0%, var(--side) 62%); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.login-card h1 { margin: 6px 0 4px; font-size: 20px; font-family: Montserrat, sans-serif; text-align: center; }
.login-card > p { text-align: center; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.brand-mark { width: 44px; height: 44px; border-radius: 11px; display: block; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.login-logo { width: 220px; display: block; margin: -6px auto 6px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 68px 1fr; height: 100vh; }
.side { background: var(--side); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; }
.side .brand-mark { width: 40px; height: 40px; font-size: 13px; margin-bottom: 14px; }
.nav-btn { position: relative; width: 48px; height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--side-text); display: grid; place-items: center; cursor: pointer; }
.nav-btn:hover { background: var(--side-2); color: #fff; }
.nav-btn.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(236,106,44,.35); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn .tip { position: absolute; left: 58px; background: #111; color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; }
.nav-btn:hover .tip { opacity: 1; }
.nav-badge { position: absolute; top: 5px; right: 5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.side .spacer { flex: 1; }
.me-btn { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--accent); background: var(--side-2); color: #fff; font-weight: 600; cursor: pointer; }
.main { min-width: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.page-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; font-family: Montserrat, sans-serif; font-weight: 600; flex: 1; min-width: 140px; }
.page-body { flex: 1; overflow: auto; padding: 20px 22px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); outline: none; }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--line-2); font-size: 11.5px; color: #3e4a5c; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; flex: none; font-size: 14px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
/* selo do canal (WhatsApp / Instagram) no canto do avatar */
.av-canal { position: relative; display: inline-flex; flex: none; align-self: flex-start; height: max-content; }
.chat-head .av-canal { align-self: center; }
.canal { position: absolute; right: -4px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
.canal svg { width: 14px; height: 14px; display: block; }
.canal.whatsapp { background: #25d366; }
.canal.instagram { background: radial-gradient(circle at 30% 110%, #fdc468 0%, #fa7e1e 25%, #d62976 55%, #962fbf 80%, #4f5bd5 100%); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.empty { display: grid; place-items: center; text-align: center; color: var(--faint); height: 100%; padding: 30px; }
.empty svg { width: 54px; height: 54px; opacity: .4; margin-bottom: 8px; }

/* ---------- conversas ---------- */
.inbox { display: grid; grid-template-columns: 340px 1fr 320px; height: 100%; min-height: 0; }
.inbox.no-ficha { grid-template-columns: 340px 1fr; }
.inbox-list { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.inbox-top { padding: 14px 14px 8px; border-bottom: 1px solid var(--line-2); }
.inbox-top .row { margin-bottom: 10px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; }
.tabs button { border: 0; background: none; padding: 7px 9px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; display: flex; gap: 5px; align-items: center; }
.tabs button.active { background: var(--accent-soft); color: var(--accent); }
.tabs .count { background: var(--line); color: var(--text); border-radius: 99px; font-size: 11px; padding: 0 6px; font-weight: 600; }
.tabs button.active .count { background: var(--accent); color: #fff; }
.tabs .count.red { background: var(--red); color: #fff; }
.conv-list { flex: 1; overflow-y: auto; }
.conv { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; position: relative; }
.conv:hover { background: var(--panel-2); }
.conv.active { background: var(--accent-soft); }
.conv.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.conv-mid { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-prev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.conv-time { font-size: 11.5px; color: var(--faint); }
.unread { background: var(--green); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; }
.wait { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); white-space: nowrap; }
.wait.late { background: var(--red); color: #fff; }
.conv-tags { display: flex; gap: 4px; margin-top: 4px; overflow: hidden; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-head .who { flex: 1; min-width: 160px; }
.chat-head .who b { display: block; }
.chat-head select.input { height: 34px; width: auto; min-width: 130px; font-size: 13px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 6% 10px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; background: rgba(255,255,255,.85); color: var(--muted); font-size: 12px; padding: 3px 12px; border-radius: 99px; margin: 10px 0; box-shadow: var(--shadow); }
.msg { max-width: 68%; padding: 7px 10px 5px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; white-space: pre-wrap; position: relative; }
.msg.in { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 3px; }
.msg.out { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 3px; }
.msg.note { align-self: center; background: var(--note); border: 1px dashed #e7c95a; max-width: 80%; }
.msg.system { align-self: center; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; padding: 2px; text-align: center; }
.msg .meta { font-size: 11px; color: var(--faint); text-align: right; margin-top: 2px; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.msg .by { font-size: 11.5px; font-weight: 600; color: var(--green); margin-bottom: 1px; }
.msg.note .by { color: var(--amber); }
.msg img, .msg video { max-width: 280px; max-height: 320px; border-radius: 7px; display: block; margin-bottom: 4px; cursor: pointer; }
.msg audio { width: 260px; display: block; }
.msg .doc { display: flex; align-items: center; gap: 8px; padding: 8px; background: rgba(0,0,0,.04); border-radius: 7px; margin-bottom: 4px; text-decoration: none; color: var(--text); }
.tick { width: 15px; height: 15px; }
.tick.read { color: #2b8be6; }
.tick.failed { color: var(--red); }
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 12px; }
.composer.note-mode { background: var(--note); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; background: var(--panel); }
.composer textarea:focus { border-color: var(--accent); }
.composer-tools { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.composer-tools .seg button { padding: 4px 10px; font-size: 12.5px; }
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel-2); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.qr-pop { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; margin-bottom: 6px; z-index: 5; }
.qr-pop div { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.qr-pop div.sel, .qr-pop div:hover { background: var(--accent-soft); }
.qr-pop b { color: var(--accent); margin-right: 6px; }
.rec { display: flex; align-items: center; gap: 8px; color: var(--red); font-weight: 600; flex: 1; padding: 0 8px; }
.rec .dot { background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.window-warn { background: var(--amber-soft); color: #8a5a00; font-size: 12.5px; padding: 6px 12px; border-radius: 8px; margin-bottom: 6px; }

.ficha { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.ficha h3 { margin: 0 0 2px; font-size: 16px; }
.ficha .sec { border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: 14px; }
.ficha .sec-t { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.ficha label.field { margin-bottom: 10px; }
.ficha .input { height: 34px; font-size: 13.5px; }
.budget-alert { background: var(--amber-soft); color: #8a5a00; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 10px; display: flex; gap: 6px; }
.budget-alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.tag-edit { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 5px; min-height: 34px; }
.tag-edit input { border: 0; outline: none; flex: 1; min-width: 80px; font-size: 13px; padding: 2px 4px; }
.task { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 13px; }
.task.late .when { color: var(--red); font-weight: 600; }
.task input { margin-top: 3px; }
.ad-box { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: #1d4f9e; margin-bottom: 10px; word-break: break-all; }

/* ---------- funil ---------- */
.board { display: flex; gap: 12px; height: 100%; overflow-x: auto; padding-bottom: 6px; }
.col { flex: 0 0 278px; display: flex; flex-direction: column; background: #e9edf3; border-radius: 12px; min-height: 0; }
.col-head { padding: 12px 12px 8px; }
.col-head .row { justify-content: space-between; }
.col-head b { font-size: 13.5px; }
.col-sum { font-size: 12px; color: var(--muted); margin-top: 2px; }
.col-bar { height: 3px; border-radius: 3px; margin-top: 8px; }
.col-body { flex: 1; overflow-y: auto; padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kcard { background: var(--panel); border-radius: 9px; padding: 10px 11px; box-shadow: var(--shadow); cursor: grab; border: 1px solid transparent; }
.kcard:hover { border-color: var(--accent); }
.kcard.dragging { opacity: .4; }
.kcard .t { font-weight: 600; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 6px; }
.kcard .l { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.kcard .money { font-weight: 600; color: var(--green); font-size: 13px; }
.kcard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ---------- tabelas ---------- */
.table-wrap { overflow: auto; }
table.t { width: 100%; border-collapse: collapse; background: var(--panel); }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- painel ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.alert .v { color: var(--red); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel { padding: 16px; }
.panel h4 { margin: 0 0 12px; font-size: 14px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 7px; font-size: 13px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--accent); }
.chart svg { width: 100%; height: 180px; display: block; }

/* ---------- conexões ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.conn { padding: 18px; }
.conn .row { justify-content: space-between; }
.conn-status { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.qr-box { display: grid; place-items: center; padding: 14px; background: var(--panel-2); border-radius: 10px; margin: 12px 0; }
.qr-box img { width: 240px; height: 240px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); padding: 7px 9px; border-radius: 7px; word-break: break-all; display: flex; gap: 8px; align-items: center; justify-content: space-between; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 36, .5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 680px; }
.modal-h { padding: 18px 20px 6px; display: flex; justify-content: space-between; align-items: center; }
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-b { padding: 10px 20px; }
.modal-f { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
#toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #172033; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 360px; font-size: 13.5px; cursor: pointer; animation: tin .2s ease-out; }
.toast.err { background: var(--red); }
.toast.alert { background: #fff; color: var(--text); border-left: 4px solid var(--red); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 150; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }

/* ---------- configurações ---------- */
.settings { display: grid; gap: 16px; max-width: 900px; }
.settings .panel h4 { margin-bottom: 4px; }
.settings .panel > p.muted { margin: 0 0 14px; font-size: 13px; }
.stage-row { display: grid; grid-template-columns: 22px 40px 1fr 140px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.stage-row input[type=color] { width: 40px; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: var(--panel); }
.drag-h { cursor: grab; color: var(--faint); text-align: center; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { display: flex; align-items: center; gap: 4px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 13px; }
.days input:checked + span { color: var(--accent); font-weight: 600; }

/* ---------- responsivo ---------- */
.back-btn { display: none; }
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px 1fr; }
  .inbox .ficha { position: fixed; right: 0; top: 0; bottom: 0; width: 340px; z-index: 40; box-shadow: var(--shadow-lg); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr 60px; }
  .side { order: 2; flex-direction: row; justify-content: space-around; padding: 0 4px; overflow-x: auto; }
  .side .brand-mark, .side .spacer { display: none; }
  .nav-btn { width: 44px; height: 44px; flex: none; }
  .nav-btn .tip { display: none; }
  .main { height: calc(100vh - 60px); }
  .inbox, .inbox.no-ficha { grid-template-columns: 1fr; }
  .inbox.has-chat .inbox-list { display: none; }
  .inbox:not(.has-chat) .chat { display: none; }
  .inbox .ficha { width: 100%; bottom: 60px; }
  .back-btn { display: inline-flex; }
  .msgs { padding: 14px 10px; }
  .msg { max-width: 86%; }
  .page-head, .page-body { padding-left: 16px; padding-right: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 96px 1fr 36px; }
}

/* ---------- identidade Mais Tech ---------- */
.kpi .v, .ficha h3, .panel h4, .modal-h h3 { font-family: Montserrat, sans-serif; }
.kpi { border-top: 3px solid var(--side); }
.kpi.alert { border-top-color: var(--red); }
.msg.out .by { color: var(--accent); }
.unread { background: var(--accent); }
.tabs button.active .count { background: var(--accent); }
.col-head b { font-family: Montserrat, sans-serif; font-weight: 600; }
.chip.blue { background: #e4ebf7; color: var(--side); }
.ad-box { background: #e9eef7; color: var(--side); }
.side { background: linear-gradient(180deg, #334260 0%, #2a3752 100%); }

/* =====================================================================
   PREMIUM
   ===================================================================== */
:root {
  --bg: #f2f4f8;
  --line: #e4e8f0;
  --line-2: #eef1f6;
  --muted: #69758a;
  --faint: #9aa5b8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27,46,79,.04), 0 4px 14px rgba(27,46,79,.06);
  --shadow-lg: 0 24px 60px rgba(15,28,52,.22);
  --gold: #ec6a2c;
}
body { letter-spacing: -.005em; }

/* sidebar */
.shell { grid-template-columns: 76px 1fr; }
.side { padding: 16px 0; gap: 6px; box-shadow: inset -1px 0 0 rgba(255,255,255,.04); }
.side .brand-mark { width: 44px; height: 44px; margin-bottom: 20px; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.nav-btn { width: 50px; height: 50px; border-radius: 14px; transition: background .15s, color .15s, transform .15s; }
.nav-btn:hover { background: rgba(255,255,255,.07); }
.nav-btn.active { background: linear-gradient(135deg, #f07a3c 0%, #e05a1d 100%); }
.nav-btn svg { width: 21px; height: 21px; stroke-width: 1.7; }
.nav-btn .tip { background: var(--side); border: 1px solid rgba(255,255,255,.08); padding: 6px 10px; border-radius: 8px; font-weight: 500; box-shadow: var(--shadow-lg); }
.nav-badge { border: 2px solid var(--side); top: 3px; right: 3px; }

/* cabeçalhos */
.page-head { padding: 20px 28px; background: rgba(255,255,255,.85); backdrop-filter: saturate(160%) blur(10px); }
.page-head h2 { font-size: 21px; letter-spacing: -.02em; }
.page-body { padding: 24px 28px; }

/* controles */
.btn { height: 38px; border-radius: 10px; border-color: var(--line); box-shadow: 0 1px 1px rgba(27,46,79,.04); transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #f07a3c 0%, #e05a1d 100%); border-color: #e05a1d; box-shadow: 0 4px 12px rgba(236,106,44,.28); }
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 6px 16px rgba(236,106,44,.36); }
.btn.green { background: linear-gradient(135deg, #22a862 0%, #178a4f 100%); box-shadow: 0 4px 12px rgba(31,157,85,.25); }
.input, select.input, textarea.input { height: 40px; border-radius: 10px; border-color: var(--line); background: #fbfcfe; transition: border-color .15s, box-shadow .15s, background .15s; }
.input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(236,106,44,.12); }
label.field > span { font-size: 11px; letter-spacing: .6px; color: #7a869b; }
.seg { background: #e9edf4; border-radius: 11px; padding: 4px; }
.seg button { border-radius: 8px; padding: 7px 14px; }
.seg button.active { box-shadow: 0 1px 2px rgba(27,46,79,.08), 0 2px 8px rgba(27,46,79,.08); color: var(--side); font-weight: 600; }
.chip { border-radius: 7px; padding: 2px 8px; font-weight: 500; }
.card { border-color: rgba(228,232,240,.9); border-radius: var(--radius); }

/* login */
.login { background:
  radial-gradient(900px 500px at 85% 110%, rgba(236,106,44,.28) 0%, transparent 60%),
  radial-gradient(1000px 520px at 10% -10%, #4a5f8a 0%, transparent 60%), #334260; }
.login-card { max-width: 400px; padding: 36px 34px 30px; border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card .btn.primary { height: 46px; font-size: 15px; font-weight: 600; border-radius: 12px; }
.login-logo { width: 200px; margin: -4px auto 14px; }
.login-card h1 { font-size: 18px; color: var(--muted); font-weight: 500; margin-bottom: 18px; }
.login-card > p { display: none; }

/* conversas */
.inbox { grid-template-columns: 360px 1fr 340px; }
.inbox.no-ficha { grid-template-columns: 360px 1fr; }
.inbox-top { padding: 18px 16px 10px; }
.tabs button { border-radius: 9px; padding: 7px 10px; }
.conv { padding: 13px 16px; margin: 2px 8px; border-radius: 12px; border-bottom: 0; transition: background .12s; }
.conv:hover { background: #f5f7fb; }
.conv.active { background: #fdf1ea; }
.conv.active::before { left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; }
.conv-name { font-weight: 600; color: var(--side); }
.avatar { box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(27,46,79,.15); }
.chat-head { padding: 12px 20px; gap: 12px; box-shadow: 0 1px 0 var(--line); border-bottom: 0; z-index: 1; }
.chat-head .who b { font-family: Montserrat, sans-serif; font-weight: 600; font-size: 15px; }
.msgs { background:
  radial-gradient(circle at 1px 1px, rgba(27,46,79,.06) 1px, transparent 0) 0 0 / 22px 22px, var(--chat-bg); gap: 6px; }
.msg { padding: 9px 12px 6px; border-radius: 14px; box-shadow: 0 1px 2px rgba(27,46,79,.08); max-width: 64%; }
.msg.in { border-top-left-radius: 4px; }
.msg.out { background: #334260; color: #fff; border-top-right-radius: 4px; }
.msg.out .meta { color: rgba(255,255,255,.6); }
.msg.out .by { color: #f6a77d; }
.msg.out a { color: #ffd2b8; }
.msg.out .doc { background: rgba(255,255,255,.1); color: #fff; }
.msg.out .tick.read { color: #8fd0ff; }
.msg.note { background: #fff8e6; border: 1px solid #f3dc9b; }
.day-sep { font-weight: 500; font-size: 11.5px; letter-spacing: .3px; text-transform: uppercase; }
.composer { padding: 12px 16px 14px; }
.composer textarea { border-radius: 14px; background: #f7f9fc; padding: 10px 14px; }
.composer textarea:focus { background: #fff; box-shadow: 0 0 0 4px rgba(236,106,44,.12); }
.composer .btn.primary.icon { width: 42px; height: 42px; border-radius: 13px; }

/* ficha */
.ficha { padding: 20px; background: #fff; }
.ficha h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.ficha .sec { border-top-color: var(--line-2); padding-top: 18px; margin-top: 18px; }
.ficha .sec-t { font-size: 11px; letter-spacing: .8px; color: #8a95a8; }
.budget-alert { background: linear-gradient(135deg, #fff4ec 0%, #ffe9db 100%); color: #a94a17; border: 1px solid #fbd3bb; border-radius: 10px; }

/* funil */
.board { gap: 16px; }
.col { background: #e8ecf3; border-radius: 16px; flex-basis: 290px; }
.col-head { padding: 14px 14px 10px; }
.col-bar { height: 4px; }
.col-body { padding: 4px 10px 12px; gap: 10px; }
.kcard { border-radius: 12px; padding: 12px 13px; border: 1px solid transparent; transition: transform .12s, box-shadow .12s, border-color .12s; }
.kcard:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(27,46,79,.12); border-color: rgba(236,106,44,.4); }
.kcard .t { color: var(--side); }

/* painel */
.kpis { gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; border-top: 0; position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--side); }
.kpi:nth-child(2)::after, .kpi:nth-child(3)::after { background: var(--accent); }
.kpi.alert::after { background: var(--red); }
.kpi .k { font-size: 11px; letter-spacing: .8px; color: #8a95a8; }
.kpi .v { font-size: 30px; color: var(--side); letter-spacing: -.02em; margin-top: 6px; }
.kpi.alert .v { color: var(--red); }
.panel { padding: 20px 22px; }
.panel h4 { font-size: 15px; font-weight: 600; color: var(--side); }
.bar-track { height: 8px; background: #edf0f5; }
.bar-fill { background: linear-gradient(90deg, #334260, #ec6a2c); }
table.t th { background: #f7f9fc; font-size: 11px; letter-spacing: .6px; color: #8a95a8; }
table.t td { border-bottom-color: #f0f3f7; }
table.t tr.click:hover td { background: #fbf6f2; }

/* modais e toasts */
.modal-back { background: rgba(15,28,52,.55); backdrop-filter: blur(3px); }
.modal { border-radius: 20px; }
.modal-h { padding: 22px 24px 8px; }
.modal-b { padding: 10px 24px; }
.modal-f { padding: 14px 24px 22px; }
.toast { background: var(--side); border-radius: 12px; padding: 12px 18px; }
.conn { padding: 22px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .page-head, .page-body { padding-left: 16px; padding-right: 16px; }
  .msg { max-width: 86%; }
}
.chat-head { flex-wrap: nowrap; }
.chat-head .who { min-width: 0; overflow: hidden; }
.chat-head .who b, .chat-head .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.chat-head select.input { min-width: 0; width: 128px; flex: none; }
.ad-box { word-break: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) { .chat-head { flex-wrap: wrap; } }

/* ---------- filtros da lista de conversas ---------- */
.filtros { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fsels { display: flex; flex-wrap: wrap; gap: 5px; }
.fsel { flex: 1 1 30%; min-width: 0; height: 28px; padding: 0 22px 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7686' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center; appearance: none; font-size: 12px; color: var(--muted); cursor: pointer; text-overflow: ellipsis; }
.fsel.on { border-color: var(--accent); color: var(--accent); background-color: var(--accent-soft); font-weight: 600; }
.ftgs { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ftg { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); color: var(--muted); font-size: 12px; cursor: pointer; }
.ftg span { font-size: 12px; line-height: 1; }
.ftg[data-t="unread"] span { color: var(--accent); font-size: 10px; }
.ftg.on { background: var(--side); border-color: var(--side); color: #fff; }
.ftg.on[data-t="unread"] span { color: #fff; }
.flimpar { border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 4px; text-decoration: underline; }

/* ---------- menu do botão direito numa conversa ---------- */
.ctx-menu { position: fixed; z-index: 200; min-width: 220px; max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: ctxIn .12s ease; }
@keyframes ctxIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.ctx-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 13px; color: var(--text); cursor: pointer; }
.ctx-menu button:hover:not([disabled]) { background: var(--accent-soft); color: var(--accent); }
.ctx-menu button[disabled] { opacity: .55; cursor: default; }
.ctx-sep { margin: 6px 4px 2px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.pres { width: 9px; height: 9px; border-radius: 50%; background: #b8c0cc; flex: none; }
.pres.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
