/* JV ZAP — estilos do painel */
:root {
  --navy: #1e3a6c;
  --blue: #2a5294;
  --blue-700: #213f75;
  --sky: #84afd8;
  --pale: #eaf1fa;
  --pale-2: #f3f7fc;
  --bg: #f2f4f8;
  --line: #e3e8ef;
  --line-2: #eef1f5;
  --text: #1c2738;
  --muted: #6b7a90;
  --green: #1f9d68;
  --green-bg: #e3f6ee;
  --amber: #b7791f;
  --amber-bg: #fff4e0;
  --red: #d64545;
  --red-bg: #fdeaea;
  --purple: #6d5bd0;
  --purple-bg: #efecfc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
button:disabled { opacity: .55; cursor: default; }
a { color: var(--blue); }
input, select, textarea { font: inherit; color: inherit; }
.input, .select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(132, 175, 216, .25); }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.45; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- estrutura ---------- */
#app { display: flex; height: 100vh; }
.rail {
  width: 70px; flex: none; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 12px; gap: 4px; z-index: 5;
}
.rail .logo { width: 42px; height: 42px; margin-bottom: 14px; }
.rail .nav {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #7b8aa0; position: relative;
}
.rail .nav svg.i { width: 21px; height: 21px; }
.rail .nav:hover { background: var(--pale-2); color: var(--blue); }
.rail .nav.active { background: var(--pale); color: var(--blue); }
.rail .nav .dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; }
.rail .nav .pill {
  position: absolute; top: 4px; right: 2px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff;
}
.rail .nav[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 54px; top: 50%; transform: translateY(-50%);
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; z-index: 30;
}
.rail .spacer { flex: 1; }
.rail .me { margin-top: 6px; }
main#view { flex: 1; min-width: 0; display: flex; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  flex: none; position: relative; letter-spacing: .3px;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 21px; }
.avatar .dept-dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #fff; }
.avatar .on-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: #b8c2d0; }
.avatar .on-dot.on { background: #22c55e; }

/* ---------- atendimento ---------- */
.inbox { flex: 1; min-width: 0; display: grid; grid-template-columns: 380px minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; box-shadow: var(--shadow); }

.list-head { padding: 12px 14px 0; }
.list-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.list-title h2 { font-size: 16px; margin: 0; flex: 1; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.tab {
  padding: 6px 2px 8px; font-weight: 600; font-size: 11.5px; color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 1px; margin-bottom: -1px; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: var(--pale-2); }
.tab.active { color: var(--blue); border-color: var(--blue); }
.tab .count { order: -1; font-size: 17px; font-weight: 700; color: #334155; line-height: 1.2; }
.tab.active .count { color: var(--blue); }
.tab .count.alert { color: var(--red); }
.list-tools { display: flex; gap: 8px; padding: 12px 14px 8px; }
.search { flex: 1; position: relative; }
.search svg.i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #93a1b5; width: 16px; height: 16px; }
.search input { padding-left: 32px; height: 36px; }
.icon-btn {
  width: 36px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; background: #fff; color: #5b6b80;
}
.icon-btn:hover { background: var(--pale-2); color: var(--blue); }
.icon-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.icon-btn.primary:hover { background: var(--blue-700); color: #fff; }
.filters { display: flex; gap: 6px; padding: 0 14px 10px; }
.filters .select { height: 32px; padding: 4px 6px; font-size: 12.5px; border-radius: 8px; min-width: 0; flex: 1; }
.filters #f-status { flex: 0 0 96px; }
.filters .select { font-size: 12px; }
.chat-list { flex: 1; overflow-y: auto; border-top: 1px solid var(--line-2); }
.chat-item { display: flex; gap: 11px; padding: 12px 14px; border-left: 3px solid transparent; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.chat-item:hover { background: #f8fafd; }
.chat-item.active { background: var(--pale); border-left-color: var(--blue); }
.ci-body { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ci-name { font-weight: 650; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ci-time.unread { color: var(--blue); font-weight: 700; }
.ci-status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 1px; white-space: nowrap; overflow: hidden; }
.ci-status .sdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ci-preview { font-size: 13px; color: #4d5b70; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.ci-preview.unread { color: var(--text); font-weight: 600; }
.ci-tags { display: flex; gap: 5px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.chip svg.i { width: 12px; height: 12px; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.purple { background: var(--purple-bg); color: var(--purple); }
.chip.gray { background: #eef1f5; color: #5b6b80; }
.chip.blue { background: var(--pale); color: var(--blue); }
.badge-unread { margin-left: auto; background: var(--blue); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.pin-ico { color: var(--blue); display: inline-flex; }
.pin-ico svg.i { width: 13px; height: 13px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; color: #b5c2d3; margin-bottom: 8px; }

/* chat */
.chat { min-width: 0; container-type: inline-size; }
@container (max-width: 900px) {
  .chat-actions .act:not(.primary):not(.resolve) span { display: none; }
  .chat-actions .act:not(.primary):not(.resolve) { width: 36px; padding: 0; justify-content: center; }
}
@container (max-width: 560px) {
  .chat-actions .act.primary span { display: none; }
  .chat-actions .act.primary { width: 36px; padding: 0; justify-content: center; }
  .chat-head .sub .chip { display: none; }
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 68px; }
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.chat-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; flex: none; }
.act {
  height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: inline-flex; gap: 6px;
  align-items: center; font-weight: 600; font-size: 12.5px; color: #3b4a60; white-space: nowrap;
}
.act:hover { background: var(--pale-2); color: var(--blue); border-color: #d3deec; }
.act svg.i { width: 16px; height: 16px; }
.act.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.act.primary:hover { background: var(--blue-700); color: #fff; }
.act.on-att { background: var(--red-bg); border-color: #f3c2c2; color: var(--red); }
.act.on-pin { background: var(--pale); border-color: #c9d9ee; color: var(--blue); }
.act.resolve { background: #e6f6ee; border-color: #a9dcc3; color: #157347; }
.act.resolve:hover { background: #1f9d68; border-color: #1f9d68; color: #fff; }
.act.icon-only { width: 36px; padding: 0; justify-content: center; }
.banner { padding: 9px 16px; font-size: 13px; font-weight: 500; display: block; line-height: 1.5; border-bottom: 1px solid var(--line-2); }
.banner svg.i { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.banner.green { background: #eaf7f1; color: #17714b; }
.banner.amber { background: #fff7e8; color: #8a5a12; }
.banner.purple { background: #f2f0fd; color: #5442b5; }
.banner.gray { background: #f3f5f8; color: #5b6b80; }
.banner.blue { background: var(--pale); color: var(--navy); }
.banner.red { background: var(--red-bg); color: #a12f2f; }
.banner .act { height: 28px; margin-left: auto; font-size: 12px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 22px 10px; background: #f6f8fb; }
.msg { display: flex; margin: 3px 0; }
.msg.out { justify-content: flex-end; }
.bubble {
  max-width: min(64%, 560px); padding: 7px 11px 5px; border-radius: 12px; box-shadow: 0 1px 1px rgba(16, 24, 40, .05);
  font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; position: relative;
}
.msg.in .bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.agent .bubble { background: var(--blue); color: #fff; border-top-right-radius: 4px; }
.msg.agent .bubble a { color: #cfe2ff; }
.msg.bot .bubble { background: #e4edf9; color: #1d335c; border-top-right-radius: 4px; }
.msg.phone .bubble { background: #dde6f1; border-top-right-radius: 4px; }
.bubble .who { font-weight: 700; font-size: 12.5px; margin-bottom: 1px; }
.msg.agent .bubble .who { color: #d8e6fb; }
.msg.bot .bubble .who, .msg.phone .bubble .who { color: var(--blue); }
.bubble .meta { font-size: 10.5px; opacity: .78; display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; }
.bubble .meta svg.i { width: 15px; height: 15px; }
.bubble .meta .read { color: #8fd0ff; opacity: 1; }
.msg.bot .bubble .meta .read, .msg.phone .bubble .meta .read { color: #2f80ed; }
.bubble .meta .failed { color: #ffb4b4; font-weight: 700; }
.msg.in .bubble .meta .failed, .msg.bot .bubble .meta .failed { color: var(--red); }
.bubble code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.msg.sys { justify-content: center; margin: 8px 0; }
.msg.sys span { background: #e9edf3; color: #55657a; font-size: 12px; padding: 4px 12px; border-radius: 12px; max-width: 80%; text-align: center; }
.day-sep { text-align: center; margin: 14px 0 8px; }
.day-sep span { background: #fff; border: 1px solid var(--line); font-size: 11.5px; padding: 3px 11px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.media-img { max-width: 280px; max-height: 300px; border-radius: 8px; display: block; cursor: zoom-in; margin-bottom: 3px; }
.media-sticker { width: 130px; height: 130px; object-fit: contain; }
.media-video { max-width: 300px; border-radius: 8px; display: block; margin-bottom: 3px; }
.doc { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; background: rgba(30, 58, 108, .07); margin-bottom: 4px; min-width: 220px; }
.msg.agent .doc { background: rgba(255, 255, 255, .14); }
.doc .fi { width: 36px; height: 36px; border-radius: 8px; background: #fff; color: var(--blue); display: grid; place-items: center; flex: none; }
.doc .dn { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc a { display: inline-flex; color: inherit; }
.composer { border-top: 1px solid var(--line); padding: 8px 14px 12px; }
.composer .sig { font-size: 12px; color: var(--muted); margin: 0 2px 6px; display: flex; gap: 6px; align-items: center; }
.composer .sig b { color: var(--navy); }
.composer .box { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 5px 5px 5px 6px; background: #fff; }
.composer .box:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(132, 175, 216, .22); }
.composer textarea { flex: 1; border: 0; resize: none; max-height: 170px; min-height: 22px; outline: none; padding: 8px 4px; line-height: 1.4; background: transparent; }
.composer .tool { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #6b7a90; }
.composer .tool:hover { background: var(--pale-2); color: var(--blue); }
.send { background: var(--blue); color: #fff; border-radius: 10px; height: 38px; padding: 0 16px; display: flex; gap: 7px; align-items: center; font-weight: 600; }
.send:hover { background: var(--blue-700); }
.attach-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--pale); color: var(--navy); border-radius: 9px; padding: 6px 8px 6px 10px; margin: 0 0 6px; font-size: 12.5px; font-weight: 600; max-width: 100%; }
.attach-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button { display: grid; place-items: center; color: var(--muted); }
.drop-hint { position: absolute; inset: 0; background: rgba(42, 82, 148, .1); border: 2px dashed var(--blue); border-radius: var(--radius); display: grid; place-items: center; font-weight: 700; color: var(--blue); z-index: 4; pointer-events: none; }
.inbox.team { grid-template-columns: minmax(0, 1fr) 300px; }
.team-members .info-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.team-members .info-head h3 { margin: 0; font-size: 15px; }
.team-members .scroll { overflow-y: auto; flex: 1; padding: 6px 0; }
.member { display: flex; gap: 11px; padding: 10px 16px; align-items: flex-start; }
.member .mn { font-weight: 650; font-weight: 600; }
.member .ms { font-size: 12px; color: var(--muted); line-height: 1.4; }
.msg.tm { align-items: flex-end; gap: 8px; }
.msg.tm .tm-av { margin-bottom: 2px; }
@media (max-width: 1100px) { .inbox.team { grid-template-columns: 1fr; } .team-members { display: none; } .team-members.show { display: flex; position: fixed; right: 12px; top: 12px; bottom: 12px; width: 300px; z-index: 20; } }
.team-av { background: #fff; border: 1px solid var(--line); }
.team-pair { background: var(--pale); color: var(--blue); }
.team-pair svg.i { width: 20px; height: 20px; }
.team-sep { padding: 10px 14px 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #8190a5; background: #fafbfd; border-bottom: 1px solid var(--line-2); }
.team-av img { width: 30px; height: 30px; }
.typing-line { min-height: 20px; padding: 0 22px; font-size: 12.5px; color: var(--muted); font-style: italic; background: #f6f8fb; }
.ref-card { background: #fff; color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--sky); border-radius: 10px; padding: 10px 12px; margin: 2px 0 6px; min-width: 250px; }
.ref-card .rc-top { font-size: 11.5px; font-weight: 700; color: var(--blue); display: flex; gap: 6px; align-items: center; text-transform: uppercase; letter-spacing: .3px; }
.ref-card .rc-top svg.i { width: 14px; height: 14px; }
.ref-card .rc-name { font-weight: 700; margin-top: 4px; }
.ref-card .rc-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.rem-card.team-toast { border-color: #c9d9ee; border-left-color: var(--blue); }
.rem-card.team-toast.mention { border-left-color: #f59e0b; box-shadow: 0 14px 34px rgba(245, 158, 11, .25); }
.team-toast.mention .rem-title { color: #b45309; }
.team-toast.mention .rem-ico { background: #fff4e0; color: #b45309; }
.notif-btn.on { color: #17714b; border-color: #a9dcc3; background: #eaf7f1; }
.notif-btn.cta { color: #fff; background: var(--blue); border-color: var(--blue); }
.notif-btn.warn { color: var(--red); border-color: #f3c2c2; background: var(--red-bg); }
.mention { background: rgba(132, 175, 216, .28); color: var(--navy); font-weight: 700; border-radius: 5px; padding: 0 3px; }
.msg.agent .bubble .mention { background: rgba(255, 255, 255, .22); color: #fff; }
.bubble.mention-me { border-color: #f5c06b !important; box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); }
.composer { position: relative; }
.mention-pop { position: absolute; left: 14px; bottom: 64px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .16); padding: 6px; z-index: 10; min-width: 260px; }
.mention-pop button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 7px 9px; border-radius: 8px; line-height: 1.25; }
.mention-pop button.sel, .mention-pop button:hover { background: var(--pale); }
.mention-pop small { color: var(--muted); }
.team-toast .rem-ico { background: var(--pale); color: var(--blue); }
.team-toast .rem-title { color: var(--blue); }
.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); background: #f6f8fb; }
.chat-empty img { width: 92px; opacity: .95; margin-bottom: 10px; }
.chat-empty h3 { color: var(--navy); margin: 4px 0; }

/* painel do contato */
.info { width: 300px; }
.info .info-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.info .info-head h3 { margin: 0; font-size: 15px; }
.info .scroll { overflow-y: auto; flex: 1; }
.info section { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.info h4 { margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: #8190a5; }
.contact-card { display: flex; gap: 12px; align-items: center; }
.contact-card .nm { font-weight: 700; font-size: 15px; }
.contact-card .ph { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.contact-card .ph button { color: var(--muted); display: inline-grid; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 8px; font-size: 13px; }
.kv .k { color: var(--muted); }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.hist { font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.hist div { display: flex; justify-content: space-between; gap: 8px; }

/* ---------- páginas de administração ---------- */
.page { flex: 1; overflow-y: auto; padding: 26px 30px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; color: var(--navy); }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head .grow { flex: 1; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--blue); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.kpi .l svg.i { width: 15px; height: 15px; }
.kpi .v { font-size: 27px; font-weight: 750; font-weight: 700; margin-top: 6px; color: var(--navy); }
.kpi.alert .v { color: var(--red); }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 15.5px; margin: 0 0 4px; color: var(--navy); }
.card .card-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-top: 0; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: #8190a5; font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 10px; }
.person .pn { font-weight: 600; }
.person .ps { font-size: 12px; color: var(--muted); }
.btn {
  height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; border: 1px solid var(--line); background: #fff; display: inline-flex;
  align-items: center; gap: 7px; white-space: nowrap; color: #34445a;
}
.btn:hover { background: var(--pale-2); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-700); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #f3c2c2; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn svg.i { width: 16px; height: 16px; }
.dept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.dept-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--c, var(--blue)); }
.dept-card .top { display: flex; align-items: center; gap: 10px; }
.dept-card .opt { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--c, var(--blue)); }
.dept-card .dn { font-weight: 700; font-size: 15px; flex: 1; }
.dept-card .members { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.dept-card .kw { font-size: 12px; color: var(--muted); }
.stack { display: flex; }
.stack .avatar { margin-left: -6px; border: 2px solid #fff; }
.stack .avatar:first-child { margin-left: 0; }
.wa-preview { background: #e8eef6; border-radius: 14px; padding: 18px; min-height: 260px; }
.wa-preview .bubble { background: #fff; color: var(--text); max-width: 100%; border-top-left-radius: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line-2); cursor: pointer; }
.check:hover { background: var(--pale-2); }
.check input { margin-top: 3px; accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.check .cl { font-weight: 600; font-size: 13.5px; }
.check .cd { font-size: 12px; color: var(--muted); margin-top: 1px; }
.check.disabled { opacity: .55; cursor: not-allowed; }
.checks { display: grid; gap: 6px; }
.checks.cols { grid-template-columns: 1fr 1fr; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.toggle input { display: none; }
.toggle .sw { width: 38px; height: 22px; border-radius: 12px; background: #cbd5e1; position: relative; transition: background .15s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle input:checked + .sw { background: var(--blue); }
.toggle input:checked + .sw::after { left: 19px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; padding: 6px 12px; border-radius: 20px; font-size: 13px; }
.status-pill .d { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.qr-box { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: center; }
.qr-box img { width: 280px; height: 280px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.qr-box ol { padding-left: 20px; line-height: 1.9; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.swatches button.sel { border-color: var(--text); box-shadow: inset 0 0 0 2px #fff; }
.log { font-size: 13px; }
.log div { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.log .lt { color: var(--muted); width: 112px; flex: none; font-size: 12px; padding-top: 1px; }

/* ---------- modal / toast / menu ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16.5px; flex: 1; color: var(--navy); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal .err { background: var(--red-bg); color: #a12f2f; padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 12px; }
.section-label { font-weight: 700; font-size: 13px; color: var(--navy); margin: 16px 0 8px; }
.lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 10px; display: block; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); animation: up .18s; }
.toast.err { background: var(--red); }
.popmenu { position: fixed; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .16); padding: 6px; z-index: 60; min-width: 210px; }
.popmenu .pm-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.popmenu button { display: flex; width: 100%; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; color: #34445a; }
.popmenu button:hover { background: var(--pale-2); }
/* lembretes */
#reminders { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 70; width: min(380px, calc(100vw - 32px)); }
.rem-card { display: flex; gap: 12px; background: #fff; border: 1px solid #f3c2c2; border-left: 5px solid var(--red); border-radius: 14px; padding: 14px; box-shadow: 0 14px 34px rgba(15, 23, 42, .18); animation: up .2s; font-size: 13.5px; line-height: 1.45; }
.rem-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--red-bg); color: var(--red); display: grid; place-items: center; flex: none; }
.rem-title { font-weight: 800; color: var(--red); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
.rem-body .muted { display: block; margin-top: 2px; font-size: 12.5px; }
.rem-actions { display: flex; gap: 6px; margin-top: 10px; }
.rem-menu { width: 330px; max-height: 70vh; overflow-y: auto; }
.rem-menu .rem-item { align-items: flex-start; text-align: left; line-height: 1.4; }
.rem-menu .rem-item svg.i { color: var(--red); margin-top: 2px; }
.rail .nav.ringing { color: var(--red); }
.rail .nav.ringing svg.i { animation: ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-5deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1280px) { .info { position: fixed; right: 12px; top: 12px; bottom: 12px; z-index: 20; box-shadow: 0 20px 50px rgba(15, 23, 42, .2); } }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } .qr-box { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-chat .list-panel { display: none; }
  .inbox:not(.has-chat) .chat { display: none; }
  .chat-actions .act span { display: none; }
}

/* Backup */
.bk-tree { font-size: 13.5px; line-height: 1.9; }
.bk-tree .i { width: 16px; height: 16px; vertical-align: -3px; color: var(--blue, #2a5294); }
.bk-tree .l1 { padding-left: 22px; } .bk-tree .l2 { padding-left: 44px; } .bk-tree .l3 { padding-left: 66px; }
code.path { user-select: all; word-break: break-all; }
#bk-list .i { width: 15px; height: 15px; vertical-align: -3px; }
.i.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Canal de clientes */
.ch-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.ch-list { margin-top: 0; padding: 8px; }
.ch-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; border-radius: 10px; }
.ch-item:hover { background: var(--pale-2); }
.ch-item.active { background: var(--pale); }
.ch-item .ch-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--pale); color: var(--blue); display: grid; place-items: center; flex: none; }
.ch-item.active .ch-ico { background: var(--blue); color: #fff; }
.ch-item .ch-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 3px #fff4e0; flex: none; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.bc-active { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fffaf0; border: 1px solid #f5dfb3; }
.bc-active .bar { height: 8px; background: #f1e3c4; border-radius: 99px; margin-top: 10px; overflow: hidden; }
.bc-active .bar span { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #d97706); border-radius: 99px; transition: width .4s; }
.am-list { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.am-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.am-row:last-child { border-bottom: 0; }
.am-row.off { opacity: .55; cursor: default; }
.am-row input { width: 16px; height: 16px; flex: none; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--pale-2); }
.msg.out.broadcast .bubble { background: #fdf3dc; color: #3d2f0c; border-top-right-radius: 4px; }
.grow { flex: 1; }
.msg.out.broadcast .who { color: #9a6408; }
@media (max-width: 1100px) { .ch-layout { grid-template-columns: 1fr; } }
