/* ============================ DIGITALVET — UI v3 ============================ */
:root {
  --bg: #0b141a; --surface: #111b21; --surface-2: #1a262e; --surface-3: #232f37;
  --border: #222e35; --text: #e9edef; --muted: #8696a0; --muted-2: #667781;
  --accent: #00a884; --accent-2: #25d366; --accent-ink: #04130d;
  --shadow: 0 4px 16px rgba(0,0,0,.28); --shadow-lg: 0 16px 48px rgba(0,0,0,.45);
  --novo: #3b82f6; --em_atendimento: #f59e0b; --pedido_exame: #a855f7; --exame_realizado: #06b6d4; --finalizado: #22c55e;
  --radius: 14px;
}
:root[data-theme="light"] {
  --bg: #eef2f5; --surface: #ffffff; --surface-2: #f4f7f9; --surface-3: #e9eef2;
  --border: #e2e8ee; --text: #111b21; --muted: #5b6b78; --muted-2: #8a98a4;
  --shadow: 0 4px 16px rgba(20,40,60,.08); --shadow-lg: 0 16px 48px rgba(20,40,60,.16);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* garante que 'hidden' vença regras de display */
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ App shell ============================ */
.app { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; display: none; overflow: auto; padding: 24px; }
.view.active { display: block; }
.chat-view { padding: 0; }
.chat-view.active { display: flex; }

/* ============================ Sidebar ============================ */
.sidebar {
  width: 244px; flex: 0 0 244px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 22px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px rgba(0,168,132,.4);
}
.brand-text { font-size: 19px; letter-spacing: .5px; font-weight: 400; }
.brand-text strong { color: var(--accent-2); font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: none; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 14.5px; font-weight: 500; font-family: inherit;
  text-align: left; border-radius: 11px; transition: background .15s, color .15s; width: 100%;
}
.nav-item .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item .nav-emoji {
  width: 24px; flex-shrink: 0; text-align: center; font-style: normal;
  font-size: 19px; line-height: 1;
  filter: drop-shadow(0 2px 2.5px rgba(0,0,0,.45)) drop-shadow(0 1px 0 rgba(255,255,255,.25));
  transition: transform .15s ease;
}
.nav-item:hover .nav-emoji { transform: scale(1.15) translateY(-1px); }
.nav-item.active .nav-emoji { transform: scale(1.18); filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 16px rgba(0,168,132,.35); }
.sidebar-foot { padding-top: 14px; border-top: 1px solid var(--border); }
.conn-pill { display: flex; align-items: center; gap: 9px; padding: 10px 13px; background: var(--surface-2); border-radius: 11px; font-size: 12.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #8696a0; flex-shrink: 0; transition: background .3s; }
.dot.open {
  background: radial-gradient(circle at 33% 28%, #7bf3b0 0%, #2bd96e 42%, #0f9d44 100%);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), inset 0 -2px 3px rgba(0,0,0,.32), 0 1px 3px rgba(0,0,0,.3), 0 0 7px rgba(37,211,102,.5);
}
.dot.connecting {
  background: radial-gradient(circle at 33% 28%, #fcd34d 0%, #f59e0b 42%, #b45309 100%);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), inset 0 -2px 3px rgba(0,0,0,.32), 0 1px 3px rgba(0,0,0,.3), 0 0 7px rgba(245,158,11,.5);
}
.dot.close, .dot.closed, .dot.unreachable {
  background: radial-gradient(circle at 33% 28%, #fca5a5 0%, #ef4444 42%, #991b1b 100%);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.55), inset 0 -2px 3px rgba(0,0,0,.32), 0 1px 3px rgba(0,0,0,.3), 0 0 7px rgba(239,68,68,.5);
}

/* ============================ Topbar ============================ */
.topbar {
  height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; background: var(--surface); border-bottom: 1px solid var(--border); position: relative;
}
.topbar-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; }
.topbar-user { font-weight: 700; font-size: 15.5px; color: var(--text); }
.topbar-user::before { content: "👤 "; }
@media (max-width: 1100px) { .topbar-center { display: none; } }
.page-title { margin: 0; font-size: 19px; font-weight: 700; }
.page-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.title-row { display: flex; align-items: center; gap: 22px; }
.title-row .conn-pill { position: relative; top: 8px; margin-left: 90px; padding: 9px 19px; font-size: 15px; font-weight: 600; gap: 12px; }
.title-row .conn-pill .dot { width: 16px; height: 16px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 18px; color: var(--text); transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); }
.user { display: flex; align-items: center; gap: 11px; padding-left: 16px; border-left: 1px solid var(--border); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-line1 { display: flex; align-items: center; gap: 7px; }
.user-name { font-size: 13px; font-weight: 700; }
.user-atend { font-size: 10.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent-2); padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.user-email { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); }
.logout-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; transition: .15s; }
.logout-btn:hover { background: #ef444422; border-color: #ef4444; color: #ef4444; }

/* ============================ Avatars ============================ */
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; background: var(--accent); }
.avatar-sm { width: 38px; height: 38px; font-size: 14px; }
.avatar-md { width: 44px; height: 44px; font-size: 16px; }
.avatar-lg { width: 52px; height: 52px; font-size: 19px; }

/* ============================ Buttons ============================ */
.btn { padding: 12px 24px; border-radius: 24px; border: none; font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; transition: filter .15s, transform .12s; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 8px 22px rgba(0,168,132,.35); }
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); }

/* ============================ Visão geral ============================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kpi-color, var(--accent)); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: color-mix(in srgb, var(--kpi-color, var(--accent)) 18%, transparent); }
.kpi-value { font-size: 30px; font-weight: 800; margin-top: 12px; }
.kpi-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.overview-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.funnel { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-name { width: 130px; font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.funnel-bar { flex: 1; height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 6px; transition: width .5s; }
.funnel-num { width: 28px; text-align: right; font-weight: 700; font-size: 13px; }
.recent-list { list-style: none; margin: 0; padding: 8px; max-height: 320px; overflow-y: auto; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.recent-item:hover { background: var(--surface-2); }
.recent-info { min-width: 0; }
.recent-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-jid { font-size: 11.5px; color: var(--muted); }
.empty-msg { color: var(--muted); text-align: center; padding: 30px; font-size: 13px; }

/* ============================ Chat ============================ */
.chat-list { width: 330px; flex: 0 0 330px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }
.chat-list-head { padding: 14px; }
.dot-legend { display: flex; gap: 16px; padding: 0 14px 12px; }
.dot-legend .leg-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.dot-legend[hidden] { display: none; }
.search { width: 100%; padding: 11px 16px; border-radius: 22px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13.5px; font-family: inherit; }
.search:focus { outline: none; border-color: var(--accent); }
.conversations { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; }
.conversations li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.conversations li:hover { background: var(--surface-2); }
.conversations li.active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.conv-jid { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-badge { background: var(--accent-2); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 11px; padding: 1px 7px; }
/* Chat Geral: indicador de mensagem nova — verde = nova, azul = sem novidade. */
.conv-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; transition: background .25s, box-shadow .25s; }
.conv-dot.blue { background: #3b82f6; }
.conv-dot.green { background: #22c55e; box-shadow: 0 0 7px #22c55e; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--bg);
  background-image: radial-gradient(var(--surface-2) 1px, transparent 1px); background-size: 22px 22px; }
.chat-empty-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 14px; }
.hero-emoji { font-size: 60px; opacity: .6; }
.chat-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-header-info { display: flex; flex-direction: column; }
.chat-title { font-weight: 700; font-size: 15px; }
.chat-jid { font-size: 12px; color: var(--muted); }
.chat-rename { margin-left: auto; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 9px; padding: 7px 13px; font-size: 12.5px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.chat-rename:hover { background: var(--surface-3); color: var(--text); }
.chat-delete { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 9px; padding: 7px 11px; font-size: 14px; line-height: 1; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chat-delete:hover { background: rgba(239,68,68,.16); color: #ef4444; border-color: rgba(239,68,68,.45); }
.chat-delete[hidden] { display: none; }
/* ---- Atribuição de conversas (Chat Geral) ---- */
.assign-filter { display: flex; flex-wrap: nowrap; gap: 5px; padding: 2px 12px 12px; }
.assign-filter[hidden] { display: none; }
.af-btn { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 7px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; font-family: inherit; white-space: nowrap; transition: transform .12s ease, box-shadow .15s ease, background .15s, color .15s; }
.af-btn .af-ico { font-size: 12px; line-height: 1; flex-shrink: 0; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.4)); }
.af-btn:hover { background: var(--surface-3); color: var(--text); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.af-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 4px 13px rgba(0,168,132,.42); }
.af-btn.active:hover { transform: translateY(-1px); box-shadow: 0 6px 17px rgba(0,168,132,.52); }
.af-btn:active { transform: translateY(0); }
/* ---- Performance ---- */
.perf-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.perf-filter { display: flex; gap: 7px; }
.perf-filter .af-btn { flex: 0 0 auto; font-size: 12.5px; padding: 8px 15px; }
.perf-table-wrap { overflow-x: auto; }
.perf-table { width: 100%; border-collapse: collapse; }
.perf-table th, .perf-table td { padding: 11px 12px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.perf-table th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.perf-table tbody tr:hover { background: var(--surface-2); }
.perf-table td:first-child { width: 42px; font-size: 17px; }
.perf-table td:nth-child(2) { font-weight: 600; }
.collab-funcao { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.collab-fsel { font-family: inherit; font-size: 12px; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
/* ---- Botão de tema (Dark/Light) maior e mais destacado ---- */
#theme-toggle { width: 52px; height: 48px; font-size: 24px; background: var(--surface-3); border: 1.5px solid var(--accent); }
#theme-toggle:hover { background: var(--accent); }
.conv-assign { display: inline-block; margin-top: 3px; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-assign.has { background: rgba(0,168,132,.16); color: var(--accent-2); }
.chat-assign { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.assign-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.assign-select { font-family: inherit; font-size: 12.5px; padding: 6px 9px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; max-width: 180px; }
.assign-select:hover { background: var(--surface-3); }
.messages { flex: 1; overflow-y: auto; padding: 22px 18%; display: flex; flex-direction: column; gap: 7px; }
.msg-day { align-self: center; background: var(--surface-2); color: var(--muted); font-size: 11.5px; padding: 4px 12px; border-radius: 10px; margin: 10px 0; }
.bubble { max-width: 75%; padding: 8px 12px 6px; border-radius: 12px; font-size: 14px; line-height: 1.4; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.15); }
.bubble.in { align-self: flex-start; background: var(--surface); border-top-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #005c4b; color: #e9edef; border-top-right-radius: 4px; }
.bubble .author { display: block; font-size: 12px; color: var(--accent-2); font-weight: 700; margin-bottom: 2px; }
.bubble .meta { display: block; text-align: right; font-size: 10.5px; color: rgba(233,237,239,.55); margin-top: 2px; }
.bubble.in .meta { color: var(--muted); }
.bubble-img-link { display: block; }
.bubble-img { display: block; max-width: 260px; max-height: 320px; width: auto; border-radius: 8px; margin-bottom: 4px; cursor: pointer; }
.msg-del { position: absolute; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: opacity .12s ease, background .12s; }
.bubble.out .msg-del { left: -34px; }
.bubble.in .msg-del { right: -34px; }
.bubble:hover .msg-del { opacity: 1; pointer-events: auto; }
.msg-del:hover { background: rgba(239,68,68,.18); }

/* modal de prévia de imagem/arquivo */
.mp-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: 20px; }
.mp-overlay[hidden] { display: none; }
.mp-modal { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 16px; }
.mp-head { display: flex; align-items: center; margin-bottom: 12px; }
.mp-title { flex: 1; font-weight: 700; font-size: 15px; color: var(--text); }
.mp-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 17px; }
.mp-close:hover { color: var(--text); }
.mp-preview { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 12px; padding: 12px; margin-bottom: 12px; max-height: 360px; overflow: hidden; }
.mp-preview img { max-width: 100%; max-height: 336px; border-radius: 8px; object-fit: contain; }
.mp-file { display: flex; align-items: center; gap: 12px; font-size: 30px; width: 100%; }
.mp-file-info { min-width: 0; }
.mp-file-name { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-word; }
.mp-file-size { font-size: 12px; color: var(--muted); }
.mp-caption { width: 100%; box-sizing: border-box; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 10px 12px; font: inherit; margin-bottom: 12px; }
.mp-caption:focus { outline: none; border-color: var(--accent); }
.mp-foot { display: flex; align-items: center; gap: 10px; }
.mp-status { margin-right: auto; font-size: 13px; color: var(--muted); }
.mp-cancel, .mp-send { padding: 9px 18px; border-radius: 11px; border: none; cursor: pointer; font: inherit; font-weight: 600; }
.mp-cancel { background: var(--surface-2); color: var(--text); }
.mp-cancel:hover { background: var(--surface-3); }
.mp-send { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.mp-send:disabled { opacity: .55; cursor: default; }
.chat-empty { color: var(--muted); text-align: center; margin: 40px auto; }
.composer { display: flex; gap: 10px; padding: 14px 18px; background: var(--surface); border-top: 1px solid var(--border); }
.composer-input { flex: 1; padding: 12px 18px; border-radius: 24px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; }
.composer-input:focus { outline: none; border-color: var(--accent); }
.composer-send { width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--accent-2); color: var(--accent-ink); font-size: 17px; cursor: pointer; flex-shrink: 0; transition: filter .15s; }
.composer-send:hover { filter: brightness(1.08); }

/* ============================ Kanban ============================ */
#view-kanban { padding: 22px; }
.kanban { display: flex; gap: 16px; height: 100%; min-height: 0; }
.kcol { flex: 1; min-width: 248px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 100%; }
.kcol-head { padding: 14px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.kcol-tag { width: 10px; height: 10px; border-radius: 50%; background: var(--col-color); box-shadow: 0 0 8px var(--col-color); }
.kcol-title { font-size: 12.5px; font-weight: 700; letter-spacing: .5px; flex: 1; }
.kcol-count { background: var(--surface-3); color: var(--muted); border-radius: 10px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
.kcol-search { margin: 10px 12px 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
.kcol-search:focus { outline: none; border-color: var(--col-color); }
.kcard-noresult { color: var(--muted-2); font-size: 12px; text-align: center; padding: 14px 0; }
.kcol-body { padding: 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kcol-body.drag-over { background: color-mix(in srgb, var(--col-color) 10%, transparent); outline: 2px dashed var(--col-color); outline-offset: -8px; border-radius: 10px; }
.kcard { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--col-color); border-radius: 11px; padding: 12px; cursor: grab; box-shadow: var(--shadow); transition: transform .08s, box-shadow .15s; }
.kcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }
.kcard-top { display: flex; align-items: center; gap: 10px; }
.kcard-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard-jid { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kcard-foot { margin-top: 9px; font-size: 11px; color: var(--muted-2); display: flex; align-items: center; gap: 5px; }
.kcard-empty { color: var(--muted-2); font-size: 12px; text-align: center; padding: 18px 0; border: 1px dashed var(--border); border-radius: 10px; }

/* ---- Kanban: modal de envio rápido (clique no card) ---- */
.kq-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: 20px; }
.kq-overlay[hidden] { display: none; }
.kq-modal { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 18px 18px 16px; }
.kq-head { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.kq-who { flex: 1; min-width: 0; }
.kq-name { font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kq-jid { font-size: 12px; color: var(--muted); margin-top: 1px; }
.kq-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 4px; }
.kq-close:hover { color: var(--text); }
.kq-text { width: 100%; box-sizing: border-box; resize: vertical; min-height: 84px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 11px 13px; font: inherit; }
.kq-text:focus { outline: none; border-color: var(--accent); }
.kq-sc { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.kq-chip { font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; font-family: inherit; }
.kq-chip:hover { background: var(--surface-3); color: var(--text); }
.kq-foot { display: flex; align-items: center; gap: 10px; }
.kq-status { margin-right: auto; font-size: 13px; color: var(--muted); }
.kq-status.kq-warn { color: #f59e0b; font-size: 12px; line-height: 1.4; max-width: 340px; text-align: left; }
.kq-cancel, .kq-send { padding: 9px 18px; border-radius: 11px; border: none; cursor: pointer; font: inherit; font-weight: 600; }
.kq-cancel { background: var(--surface-2); color: var(--text); }
.kq-cancel:hover { background: var(--surface-3); }
.kq-send { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.kq-send:disabled { opacity: .55; cursor: default; }

/* ============================ Contatos ============================ */
#view-contatos { padding: 0; }
#view-contatos.active { display: flex; }
.contacts-wrap { display: flex; width: 100%; height: 100%; }
.contacts-list { width: 320px; flex: 0 0 320px; }
.contact-detail { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg); }
.contacts-head { display: flex; gap: 8px; align-items: center; }
.contacts-head .search { flex: 1; }
.icon-btn-sm { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 17px; }
.icon-btn-sm:hover { background: var(--surface-3); }
.contact-form { max-width: 760px; margin: 0 auto; padding: 28px; }
.contact-form-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.cf-waname { font-size: 19px; font-weight: 700; }
.cf-jid { font-size: 13px; color: var(--muted); }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.cf-section { margin: 6px 0 14px; font-size: 15px; border-top: 1px solid var(--border); padding-top: 18px; }
.cf-section small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.cf-label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cf-label input { padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; }
.cf-label input:focus { outline: none; border-color: var(--accent); }
.cf-label select { padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; }
.cf-label select:focus { outline: none; border-color: var(--accent); }
.cf-modal-body .cf-grid { margin-bottom: 16px; }
.cf-pets-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; border-top: 1px solid var(--border); padding-top: 20px; }
.cf-pets-head h4 { margin: 0; font-size: 15px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.pet-row { display: grid; grid-template-columns: 2fr 1.3fr 1fr 1.2fr auto; gap: 10px; margin-bottom: 10px; align-items: center; }
.pet-row input { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13.5px; font-family: inherit; }
.pet-row input:focus { outline: none; border-color: var(--accent); }
.pet-del { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.pet-del:hover { background: #ef444422; border-color: #ef4444; color: #ef4444; }
.cf-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.cf-status { font-size: 13px; color: var(--muted); }

/* ============================ Atalhos ============================ */
.shortcuts-wrap { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.sc-form { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.sc-form textarea { padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; resize: vertical; }
.sc-form textarea:focus, .sc-form input:focus { outline: none; border-color: var(--accent); }
.sc-form-actions { display: flex; align-items: center; gap: 10px; }
.sc-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 200px); overflow-y: auto; }
.sc-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; }
.sc-item-top { display: flex; align-items: center; gap: 10px; }
.sc-tag { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-2); font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 8px; font-family: ui-monospace, monospace; }
.sc-title { font-weight: 600; font-size: 13.5px; flex: 1; }
.sc-acts { display: flex; gap: 6px; }
.sc-acts button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.sc-acts button:hover { background: var(--surface-3); color: var(--text); }
.sc-text { margin-top: 8px; font-size: 13px; color: var(--muted); white-space: pre-wrap; line-height: 1.4; }

/* popup de atalhos no chat */
.sc-popup { position: absolute; left: 14px; right: 14px; bottom: 78px; max-height: 280px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 20; display: flex; flex-direction: column; }
.sc-popup-head { padding: 10px 14px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.sc-popup-hint { font-weight: 500; opacity: .7; }
.sc-popup-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.sc-popup-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.sc-popup-item:hover { background: var(--surface-2); }
.sc-popup-text { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-popup-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; list-style: none; }
.composer-sc { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--accent-2); font-size: 18px; cursor: pointer; flex-shrink: 0; }
.composer-sc:hover { background: var(--surface-3); }
.composer-attach { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--accent-2); font-size: 18px; cursor: pointer; flex-shrink: 0; }
.composer-attach:hover { background: var(--surface-3); }
.chat-thread { position: relative; }

/* ============================ Melhorias ============================ */
.imp-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 200px); overflow-y: auto; }
.imp-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 13px 15px; }
.imp-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.imp-titulo { font-weight: 700; font-size: 14px; }
.imp-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 9px; white-space: nowrap; background: color-mix(in srgb, var(--st) 20%, transparent); color: var(--st); }
.imp-desc { margin-top: 7px; font-size: 13px; color: var(--muted); white-space: pre-wrap; line-height: 1.4; }
.imp-meta { margin-top: 8px; font-size: 11.5px; color: var(--muted-2); }
.imp-ctl { margin-top: 10px; display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; }
.imp-select { flex: 1; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px; }
.imp-select:focus { outline: none; border-color: var(--accent); }

/* ============================ Colaboradores ============================ */
.collab-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.collab-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.collab-info { flex: 1; min-width: 0; }
.collab-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.collab-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.collab-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 8px; }
.collab-badge.ok { background: color-mix(in srgb, var(--finalizado) 22%, transparent); color: var(--finalizado); }
.collab-badge.pend { background: color-mix(in srgb, var(--em_atendimento) 25%, transparent); color: var(--em_atendimento); }
.collab-acts { display: flex; gap: 8px; }

/* ============================ WhatsApp ============================ */
#view-whatsapp { padding: 0; }
#view-whatsapp.active { display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; }
.wa-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 32px 36px; max-width: 430px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); margin: 28px auto; }
.wa-icon { width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 36px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(0,168,132,.4); }
.wa-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.wa-sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.wa-qrbox { background: #fff; border-radius: 14px; width: 228px; height: 228px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; padding: 11px; }
.wa-qr { width: 206px; height: 206px; image-rendering: pixelated; }
.wa-placeholder { color: #475569; font-size: 14px; line-height: 1.5; max-width: 220px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wa-ph-emoji { font-size: 40px; }
.wa-conn { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wa-conn strong { font-size: 18px; color: var(--text); }
.wa-num { font-size: 16px; font-weight: 700; color: var(--accent-2); font-family: ui-monospace, monospace; }
.wa-steps { text-align: left; max-width: 320px; margin: 0 auto 22px; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.wa-steps strong { color: var(--text); }
.wa-actions { display: flex; gap: 12px; justify-content: center; }
.wa-hint { margin: 16px 0 0; color: var(--muted); font-size: 12px; min-height: 16px; }

/* ============================ Login ============================ */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; overflow: hidden; position: relative;
  background: radial-gradient(1200px 600px at 80% -10%, #14533a 0%, transparent 55%), radial-gradient(900px 500px at -10% 110%, #0e3f2c 0%, transparent 55%), linear-gradient(135deg, #0a1118 0%, #0d1b16 100%); }
.login-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.blob-1 { width: 420px; height: 420px; background: #1f9d6b; top: -120px; right: -80px; }
.blob-2 { width: 360px; height: 360px; background: #25d366; bottom: -120px; left: -90px; opacity: .35; }
.float-pet { position: absolute; font-size: 46px; opacity: .16; filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); animation: floaty 7s ease-in-out infinite; }
.float-pet.p1 { top: 12%; left: 12%; font-size: 64px; }
.float-pet.p2 { top: 22%; right: 14%; font-size: 58px; animation-delay: 1.2s; }
.float-pet.p3 { bottom: 16%; left: 18%; font-size: 40px; animation-delay: .6s; }
.float-pet.p4 { bottom: 22%; right: 20%; font-size: 44px; animation-delay: 2s; }
.float-pet.p5 { top: 48%; left: 6%; font-size: 34px; animation-delay: 1.6s; }
.float-pet.p6 { top: 8%; right: 38%; font-size: 40px; animation-delay: 2.6s; }
.float-pet.p7 { bottom: 8%; right: 42%; font-size: 50px; animation-delay: .9s; }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-18px) rotate(4deg); } }
.login-card { position: relative; z-index: 1; width: 380px; max-width: 92vw; padding: 42px 38px 30px; display: flex; flex-direction: column; align-items: center;
  background: rgba(22,32,44,.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.12); border-radius: 24px; box-shadow: var(--shadow-lg);
  animation: login-in .5s cubic-bezier(.2,.8,.2,1); }
@keyframes login-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.login-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }
.login-logo-slot { width: 200px; height: 110px; margin-bottom: 18px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.22); }
.login-logo-img { display: none; max-width: 184px; max-height: 94px; object-fit: contain; }
.login-logo-fallback { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.login-logo-fallback .paw { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(37,211,102,.45); }
.login-logo-fallback .wd { font-size: 22px; letter-spacing: 1.5px; font-weight: 300; color: #fff; }
.login-logo-fallback .wd strong { color: var(--accent-2); font-weight: 800; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 26px; max-width: 280px; }
.login-tabs { display: flex; width: 100%; background: rgba(255,255,255,.06); border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.login-tab { flex: 1; padding: 10px; border: none; background: transparent; color: rgba(255,255,255,.7); font-weight: 700; font-size: 14px; border-radius: 9px; cursor: pointer; font-family: inherit; transition: .15s; }
.login-tab.active { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #04241a; }
.login-panel { width: 100%; display: flex; flex-direction: column; }
.login-h { margin: 0 0 4px; font-size: 21px; font-weight: 800; color: #fff; text-align: center; }
.login-fieldlabel { font-size: 11.5px; color: rgba(255,255,255,.55); margin: 2px 2px 6px; }
.login-switch { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.login-switch .login-link { display: inline; margin: 0; font-weight: 700; color: var(--accent-2); }
.login-row { display: flex; gap: 10px; }
.login-row .login-field { flex: 1; }
.login-row .login-field input { padding-left: 12px; }
.code-info { color: rgba(255,255,255,.8); font-size: 13px; line-height: 1.5; text-align: center; margin: 0 0 16px; }
.code-info strong { color: var(--accent-2); }
.code-field input { text-align: center; font-size: 26px; letter-spacing: 10px; font-weight: 700; padding: 14px 12px; }
.login-link { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; margin-top: 12px; font-family: inherit; }
.login-link:hover { color: var(--text); }
.login-field { position: relative; width: 100%; margin-bottom: 14px; display: flex; align-items: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.login-field:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(37,211,102,.18); }
.login-ico { padding: 0 12px; font-size: 16px; opacity: .8; }
.login-field input { flex: 1; padding: 14px 12px 14px 0; border: none; background: transparent; color: #fff; font-size: 15px; font-family: inherit; }
.login-field input:focus { outline: none; }
.login-field input::placeholder { color: rgba(255,255,255,.45); }
.login-eye { background: none; border: none; cursor: pointer; font-size: 15px; padding: 0 12px; opacity: .7; }
.login-eye:hover { opacity: 1; }
.login-btn { margin-top: 8px; width: 100%; padding: 14px; border-radius: 12px; border: none; cursor: pointer; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #04241a; font-weight: 800; font-size: 16px; letter-spacing: .5px; box-shadow: 0 8px 22px rgba(37,211,102,.35); transition: transform .12s, filter .15s; font-family: inherit; }
.login-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.login-error { color: #fca5a5; font-size: 13px; text-align: center; min-height: 18px; margin: 12px 0 0; }
.login-foot { color: rgba(255,255,255,.5); font-size: 11px; letter-spacing: .5px; margin: 18px 0 0; }

@media (max-width: 880px) {
  .sidebar { width: 72px; flex-basis: 72px; }
  .brand-text, .nav-item span { display: none; }
  .overview-row { grid-template-columns: 1fr; }
  .messages { padding: 18px 6%; }
}

.login-hint-small { font-size: 12px; color: rgba(255,255,255,.6); text-align: center; margin: 14px 0 0; line-height: 1.4; }
