/* Conecta — interface da central. Sem dependências externas; fontes do sistema para carregar rápido. */
:root {
  --green: #0f5c47;
  --green-600: #146c55;
  --green-100: #d7eadf;
  --green-50: #eaf4ee;
  --ink: #1b2a25;
  --text-2: #43534c;
  --muted: #5b6a63;
  --border: #d6dfd9;
  --border-soft: #e6ece8;
  --bg: #f3f6f4;
  --white: #fff;
  --warn: #8a5a12;
  --warn-bg: #fdf1d9;
  --danger: #a12f2f;
  --danger-bg: #fbe9e9;
  --bot: #54417f;
  --bot-bg: #eeeaf8;
  --info: #1f5f8b;
  --info-bg: #e5f0f8;
  --chat-bg: #efeae2;
  --chat-dot: #0b141a0d;
  --bubble-in: #fff;
  --bubble-out: #d9fdd3;
  --bar: #f0f2f5;
  --bar-text: #54656f;
  --meta: #667781;
  --author: #1d8a63;
  --note-bg: #fff3c5;
  --note-text: #54656f;
  --surface-2: #f8faf9;
  --track: #e4ebe7;
  --hover: #f7faf8;
  --th-bg: #f0f5f2;
  --field-border: #b7c5bd;
  --switch-off: #9aa9a1;
  --danger-solid: #a12f2f;
  --radius: 12px;
  --shadow: 0 1px 2px #0f2a2112, 0 4px 14px #0f2a2108;
  --topbar: 68px;
  font-size: 15px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; color: var(--ink); background: var(--bg); line-height: 1.5; }
h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
svg { width: 1.2em; height: 1.2em; flex: none; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
kbd { font: inherit; font-size: .8em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--white); }

/* Acessibilidade */
:focus-visible { outline: 3px solid #2f8f72; outline-offset: 2px; border-radius: 6px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--green); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; }
.noscript { margin: 0; padding: 16px; background: var(--warn-bg); color: var(--warn); text-align: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 10px; font-weight: 600; font-size: .95rem; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #0b4a39; }
.btn.secondary { background: var(--white); border-color: var(--border); color: var(--ink); }
.btn.secondary:hover:not(:disabled) { background: var(--green-50); border-color: var(--field-border); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--green-50); }
.btn.danger { background: var(--white); border-color: #e3b9b9; color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--white); display: inline-grid; place-items: center; }
.icon-btn.ghost { border-color: transparent; background: none; color: var(--text-2); }
.icon-btn:hover { background: var(--green-50); }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
label, .label { font-weight: 600; font-size: .92rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--white); border: 1px solid var(--field-border); border-radius: 10px; font-size: 1rem; }
textarea { resize: vertical; line-height: 1.6; min-height: 96px; }
input::placeholder, textarea::placeholder { color: #6d7b74; }
input:focus, select:focus, textarea:focus { outline: 3px solid #2f8f7250; border-color: var(--green-600); }
form > label { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.password-field .icon-btn { position: absolute; right: 3px; top: 1px; }
.form-error { color: var(--danger); font-size: .92rem; margin: 0 0 12px; }
.form-error:empty { display: none; }
.hint, .help { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.hint.center { text-align: center; margin-top: 14px; }
.help { margin: 6px 0 14px; }
.help code, code { font-family: Consolas, monospace; font-size: .88em; background: var(--green-50); padding: 1px 6px; border-radius: 4px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.switch button { position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--switch-off); transition: background .15s; flex: none; }
.switch button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch button[aria-checked="true"] { background: var(--green-600); }
.switch button[aria-checked="true"]::after { transform: translateX(20px); }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.6rem; font-weight: 800; letter-spacing: -1px; }
.brand img { border-radius: 10px; }

/* Login */
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.login-story { background: linear-gradient(160deg, #0f5c47 0%, #0a3f31 100%); color: #fff; padding: 48px clamp(28px, 8%, 96px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; position: relative; overflow: hidden; }
.login-story::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; right: -180px; bottom: -190px; box-shadow: 0 0 0 50px #ffffff0d, 0 0 0 100px #ffffff08; pointer-events: none; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #a8dcc5; margin-bottom: 18px; }
.login-story h1 { font-size: clamp(2rem, 3.2vw, 3.1rem); line-height: 1.12; letter-spacing: -.035em; font-weight: 650; margin-bottom: 32px; }
.login-story h1 em { font-style: normal; color: #9ce6c4; }
.story-points { display: grid; gap: 16px; max-width: 460px; }
.story-points li { display: flex; gap: 14px; align-items: flex-start; color: #d9efe5; line-height: 1.5; }
.story-points strong { color: #fff; }
.story-icon { width: 38px; height: 38px; border-radius: 10px; background: #ffffff1a; flex: none; }
.story-foot { color: #a8cfbe; font-size: .9rem; position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--white); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 2rem; letter-spacing: -.03em; margin-bottom: 8px; }
.login-card .lead { color: var(--muted); margin-bottom: 28px; }
.demo-login { margin-top: 28px; padding: 18px; border: 1px dashed #a9c4b7; border-radius: var(--radius); background: var(--green-50); }
.demo-login h3 { font-size: 1rem; margin-bottom: 4px; }
.demo-login p { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.demo-buttons { display: grid; gap: 8px; }
.demo-buttons .btn { justify-content: flex-start; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 28px; color: var(--muted); font-size: .85rem; }

/* App */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: 256px; flex: none; background: var(--white); border-right: 1px solid var(--border); padding: 20px 14px 14px; display: flex; flex-direction: column; height: 100vh; height: 100dvh; position: sticky; top: 0; overflow-y: auto; }
/* Menu lateral em gaveta: fica oculto e abre pelo botão de menu, em qualquer largura. */
.sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: min(86vw, 300px); transform: translateX(-102%); visibility: hidden; transition: transform .2s, visibility 0s .2s; box-shadow: 20px 0 60px #0b1f1840; }
.sidebar.open { transform: none; visibility: visible; transition: transform .2s, visibility 0s; }
.sidebar-close, .mobile-nav { display: inline-grid; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.workspace { display: flex; gap: 10px; align-items: center; margin: 20px 4px 16px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg); }
.workspace-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--green-100); color: var(--green); display: grid; place-items: center; font-weight: 700; flex: none; }
.workspace strong { display: block; font-size: .92rem; line-height: 1.2; overflow-wrap: anywhere; }
.workspace small { color: var(--muted); font-size: .8rem; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 14px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text-2); font-weight: 550; text-align: left; }
.nav-item:hover { background: var(--green-50); }
.nav-item.active { background: var(--green-50); color: var(--green); font-weight: 700; box-shadow: inset 3px 0 0 var(--green-600); }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--danger-solid); color: #fff; font-size: .78rem; text-align: center; }
.sidebar-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.user-card { display: flex; gap: 10px; align-items: center; padding: 4px 6px 10px; }
.user-card strong { display: block; font-size: .92rem; line-height: 1.2; }
.user-card small { color: var(--muted); }
.user-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--green-100); color: var(--green); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex: none; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 14px; padding: 0 28px; background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1.3rem; letter-spacing: -.02em; line-height: 1.2; }
.topbar-title h1:focus { outline: none; }
.topbar-title p { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; background: var(--info-bg); color: var(--info); font-size: .82rem; font-weight: 650; white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--green-100); color: var(--green); }
.pill.ok::before, #wa-badge:not(.ok)::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.main { flex: 1; min-width: 0; padding: 18px 28px 28px; outline: none; }
.demo-banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; margin-bottom: 14px; background: var(--info-bg); border: 1px solid #bcd7e8; color: #17476a; border-radius: 10px; font-size: .92rem; }
.scrim { position: fixed; inset: 0; background: #0b1f1870; z-index: 40; }

/* Caixa de entrada */
.inbox { display: flex; height: calc(100vh - var(--topbar) - 46px); height: calc(100dvh - var(--topbar) - 46px); min-height: 460px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.conversation-list { width: 360px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.list-tools { padding: 14px 14px 0; border-bottom: 1px solid var(--border-soft); }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--white); color: var(--muted); }
.search-box:focus-within { outline: 3px solid #2f8f7250; border-color: var(--green-600); }
.search-box input { border: 0; outline: 0; min-height: 42px; padding: 0; background: none; box-shadow: none; }
.search-box input:focus { outline: 0; }
.owner-filter { margin-top: 10px; min-height: 40px; font-size: .92rem; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--white); font-size: .88rem; font-weight: 600; color: var(--text-2); }
.chip:hover { background: var(--green-50); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.chip b { font-weight: 700; font-size: .8rem; background: #0000000f; border-radius: 99px; padding: 0 7px; }
.chip[aria-pressed="true"] b { background: #ffffff30; }
.conversation-items { flex: 1; overflow-y: auto; min-height: 0; }
.conversation-item { display: flex; gap: 12px; width: 100%; padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--border-soft); border-left: 4px solid transparent; align-items: flex-start; }
.conversation-item:hover { background: var(--hover); }
.conversation-item.selected { background: var(--green-50); border-left-color: var(--green-600); }
.conversation-item.unread .conversation-line strong { font-weight: 800; }
.conversation-item.unread .conversation-info p { color: var(--ink); font-weight: 600; }
.conversation-info { flex: 1; min-width: 0; }
.conversation-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conversation-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.conversation-line time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.conversation-info p { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 7px; display: flex; gap: 5px; align-items: center; }
.conversation-info p svg { width: 1em; height: 1em; }
.meta-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 650; background: var(--green-50); color: var(--green); white-space: nowrap; }
.tag.bot { background: var(--bot-bg); color: var(--bot); }
.tag.queue, .tag.wait { background: var(--warn-bg); color: var(--warn); }
.tag.closed { background: var(--track); color: var(--text-2); }
.tag.stage { background: var(--info-bg); color: var(--info); }
.unread-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--green-600); color: #fff; font-size: .78rem; font-weight: 700; text-align: center; }
.empty-list { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty-list strong { display: block; color: var(--ink); margin-bottom: 4px; }
.list-footer { padding: 9px; text-align: center; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border-soft); }
.tiny-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3aa37f; margin-right: 6px; }

/* Conversa */
.chat { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); position: relative; }
.chat.dragging::after { content: "Solte o arquivo para anexar"; position: absolute; inset: 10px; display: grid; place-items: center; border: 2px dashed var(--green-600); border-radius: 14px; background: #eaf4eef0; font-weight: 700; color: var(--green); z-index: 5; }
.chat-empty { margin: auto; max-width: 380px; text-align: center; padding: 30px; color: var(--muted); }
.empty-symbol { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: var(--green-50); color: var(--green-600); margin-bottom: 18px; }
.empty-symbol svg { width: 34px; height: 34px; }
.chat-empty h2 { color: var(--ink); font-size: 1.2rem; margin-bottom: 6px; }
.chat-header { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; padding: 12px 18px; background: var(--white); border-bottom: 1px solid var(--border); }
.chat-title { min-width: 0; flex: 1 1 180px; }
.chat-title strong { display: block; font-size: 1.05rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title small { color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.chat-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-select { width: auto; min-height: 38px; padding: 4px 30px 4px 10px; font-size: .9rem; font-weight: 600; }
.chat-back { display: inline-grid; }
/* Com uma conversa aberta, a lista fica oculta e só aparece (sobreposta) quando acionada pelo botão do cabeçalho. */
.inbox.has-selection .conversation-list { display: none; }
.inbox.has-selection.list-open .conversation-list { display: flex; position: absolute; z-index: 6; top: 0; bottom: 0; left: 0; width: min(380px, 100%); background: var(--white); box-shadow: 14px 0 34px #0b1f1824; }
.chat-origin { text-align: center; font-size: .82rem; color: var(--muted); padding: 12px 18px 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px 22px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.chat-date { align-self: center; margin: 12px 0 2px; padding: 3px 12px; border-radius: 99px; background: var(--track); color: var(--text-2); font-size: .8rem; font-weight: 600; }
.chat-date::first-letter { text-transform: uppercase; }
.message { max-width: min(78%, 620px); align-self: flex-start; }
.message.out { align-self: flex-end; }
.message-author { font-size: .8rem; color: var(--muted); margin: 0 4px 3px; font-weight: 600; }
.message-bubble { padding: 10px 14px; background: var(--white); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.out .message-bubble { background: #dff0e6; border-color: #bfdcca; border-radius: 14px 4px 14px 14px; }
.message.bot .message-bubble { background: var(--bot-bg); border-color: #d6cdee; }
.message-bubble:empty { display: none; }
.message-bubble .tag { margin-bottom: 6px; }
.message-meta { display: flex; justify-content: flex-end; gap: 6px; margin: 3px 4px 0; font-size: .78rem; color: var(--muted); }
.message-error { margin: 4px 4px 0; padding: 6px 10px; border-radius: 8px; background: var(--danger-bg); color: var(--danger); font-size: .85rem; }
.msg-media { display: block; margin-bottom: 6px; }
.msg-image { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; background: var(--track); }
.msg-video { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.msg-audio { width: min(300px, 100%); }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #ffffffb0; border: 1px solid var(--border); font-weight: 600; color: var(--green); overflow-wrap: anywhere; }
.msg-file:hover { background: var(--white); }

/* Compositor */
.composer { background: var(--white); border-top: 1px solid var(--border); padding: 12px 18px 10px; }
.composer form { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 44px; height: 44px; max-height: 160px; resize: none; overflow-y: hidden; }
.composer form .icon-btn, .composer form .btn { height: 44px; min-height: 44px; }
.composer #send-button:disabled:not(.loading) { background: var(--border-soft); border-color: var(--border); color: var(--muted); cursor: not-allowed; box-shadow: none; }
.composer-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.composer-foot .over { color: var(--danger); font-weight: 700; }
.attachment-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--green-50); font-weight: 600; }
.attachment-chip span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip .icon-btn { margin-left: auto; width: 34px; height: 34px; }
.composer-notice { padding: 16px 20px; text-align: center; background: var(--white); border-top: 1px solid var(--border); color: var(--text-2); }
.composer-notice strong { color: var(--ink); }
.template-box { background: var(--warn-bg); border-top: 1px solid #ecd49c; padding: 14px 18px; }
.template-box h3 { font-size: 1rem; margin-bottom: 4px; color: var(--warn); }
.template-box .field { margin: 10px 0 0; }
.template-preview { margin-top: 10px; padding: 10px 12px; background: var(--white); border-radius: 10px; border: 1px solid #ecd49c; white-space: pre-wrap; }

/* Painel do cliente */
.inbox { position: relative; }
/* Detalhes do cliente: coluna ao lado da conversa (empurra o chat); só aparece quando acionado pelo botão do cabeçalho. */
.contact-panel { position: relative; width: 300px; flex: none; border-left: 1px solid var(--border); padding: 20px 18px; overflow-y: auto; background: var(--white); }
@media (max-width: 1000px) { .contact-panel { position: absolute; z-index: 6; top: 0; right: 0; bottom: 0; width: min(320px, 100%); box-shadow: -14px 0 34px #0b1f1824; } }
.contact-close { position: absolute; top: 8px; right: 8px; }
.contact-person { text-align: center; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.contact-person .avatar { width: 64px; height: 64px; font-size: 1.2rem; margin-bottom: 10px; }
.contact-person h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
.phone-line { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-top: 2px; }
.phone-line .icon-btn { width: 34px; height: 34px; border: 0; }
.contact-details { padding-top: 6px; }
.contact-details dt { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 16px; }
.contact-details dd { margin-top: 2px; }
.owner-card { margin-top: 20px; padding: 12px 14px; border-radius: 10px; background: var(--green-50); color: var(--green); font-size: .88rem; }
.owner-card strong { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.owner-card p { color: var(--text-2); }

/* Páginas de gestão */
.content-view { max-width: 1240px; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 18px; }
.card h2, .section-heading h2 { font-size: 1.15rem; letter-spacing: -.01em; margin-bottom: 4px; }
.card h3 { font-size: 1rem; margin-bottom: 4px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-weight: 600; font-size: .9rem; }
.stat-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--green-50); color: var(--green-600); display: grid; place-items: center; }
.stat-value { font-size: 2rem; font-weight: 750; letter-spacing: -.03em; margin: 6px 0 2px; line-height: 1.1; }
.stat small { color: var(--muted); }
.stat.alert .stat-value { color: var(--danger); }
.checklist { display: grid; gap: 8px; margin-top: 12px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 10px; }
.check-item .mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--switch-off); display: grid; place-items: center; flex: none; color: #fff; }
.check-item.done .mark { background: var(--green-600); border-color: var(--green-600); }
.check-item .mark svg { width: 14px; height: 14px; }
.check-item .btn { margin-left: auto; }
.attention-list { display: grid; gap: 6px; margin-top: 10px; }
.attention-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 10px; text-align: left; }
.attention-item:hover { background: var(--green-50); }
.attention-item span:nth-child(2) { flex: 1; min-width: 0; }
.attention-item strong, .attention-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-item small { color: var(--muted); }
.bars { display: grid; gap: 14px; margin-top: 14px; }
.bar-title { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; margin-bottom: 5px; }
.bar-title span:last-child { color: var(--muted); font-weight: 500; }
.bar-track { height: 12px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--green-600); border-radius: 99px; transition: width .45s ease; }
.bar-fill.won { background: #2f9e6f; }
.bar-fill.lost { background: #b9605c; }
.day-chart { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin-top: 14px; padding-top: 10px; }
.day-bar { flex: 1; min-width: 3px; background: var(--green-600); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.day-bar:hover { opacity: 1; }
.day-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
caption { text-align: left; padding: 0 0 8px; color: var(--muted); font-size: .9rem; }
th { padding: 11px 14px; background: var(--th-bg); color: var(--text-2); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); }
.cell-person { display: flex; gap: 12px; align-items: center; }
.cell-person strong { display: block; }
.period { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--white); }
.period button { min-height: 40px; padding: 0 16px; font-weight: 600; color: var(--text-2); }
.period button[aria-pressed="true"] { background: var(--green); color: #fff; }
.integration-status { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--green-50); color: var(--green); font-weight: 600; margin: 12px 0; }
.integration-status.warn { background: var(--warn-bg); color: var(--warn); }
.integration-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.result-box { margin: 12px 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.qr-code { display: block; width: 260px; max-width: 100%; height: auto; margin: 12px auto; padding: 10px; background: #fff; border-radius: 10px; }
.steps { padding-left: 20px; margin: 8px 0 0; color: var(--text-2); display: grid; gap: 4px; list-style: decimal; }
.audit-detail { max-width: 420px; overflow-wrap: anywhere; color: var(--text-2); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input { max-width: 320px; }

/* Modal e aviso */
dialog { border: 0; border-radius: 16px; padding: 24px; width: 500px; max-width: calc(100vw - 24px); max-height: 92vh; box-shadow: 0 24px 80px #0b1f1850; color: var(--ink); }
dialog::backdrop { background: #0b1f1880; }
.modal-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-heading h2 { font-size: 1.3rem; letter-spacing: -.02em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#modal-content .field, #modal-content > label { margin-bottom: 14px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 14px; max-width: min(92vw, 560px); padding: 13px 18px; border-radius: 12px; background: #12392e; color: #fff; box-shadow: 0 10px 30px #0b1f1850; font-weight: 550; }
.toast.error-toast { background: #8f2b2b; }
.toast button { color: #bff0d9; font-weight: 700; text-decoration: underline; min-height: 32px; }
.toast.error-toast button { color: #ffd9d9; }

/* Responsivo */
@media (max-width: 1240px) {
  .conversation-list { width: 330px; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; transform: translateX(-102%); transition: transform .2s; box-shadow: 20px 0 60px #0b1f1840; width: min(86vw, 300px); }
  .sidebar.open { transform: none; }
  .sidebar-close, .mobile-nav { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .main { padding: 12px 12px 20px; }
  .topbar-title p { display: none; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-story { padding: 26px 24px; gap: 18px; }
  .login-story h1 { font-size: 1.9rem; margin-bottom: 0; }
  .story-points, .story-foot, .login-story .eyebrow { display: none; }
  .login-story::after { display: none; }
  .login-panel { align-items: flex-start; padding-top: 28px; }
}
@media (max-width: 760px) {
  .inbox { height: calc(100dvh - var(--topbar) - 24px); border-radius: 10px; }
  .conversation-list { width: 100%; border-right: 0; }
  .inbox.has-selection .conversation-list { display: none; }
  .inbox:not(.has-selection) .chat { display: none; }
  .chat-back { display: inline-grid; }
  .chat-messages { padding: 8px 12px 14px; }
  .message { max-width: 90%; }
  .grid.four { grid-template-columns: 1fr 1fr; }
  #simulate-button span:not([data-icon]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar-right .pill { display: none; }
  .topbar-right #wa-badge:not([hidden]) { display: inline-flex; }
  .card { padding: 16px; }
  .toast { bottom: 12px; }
}
@media (max-width: 420px) {
  .grid.four { grid-template-columns: 1fr; }
  .chat-actions .btn span:not([data-icon]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.flush { margin: 0 !important; }
.mt12 { margin-top: 12px; }
.workload { margin-left: auto; font-size: 1.4rem; }

.grid > .card, .grid > section.card { margin-top: 0; }

.composer { position: relative; }
.recorder-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 2px; }
.recorder-bar .rec-label { color: var(--muted); flex: 1 1 160px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #d23b3b; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.quick-menu { position: absolute; left: 18px; right: 18px; bottom: calc(100% - 4px); max-height: 280px; overflow-y: auto; background: var(--white); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px #0b1f1830; padding: 6px; z-index: 6; }
.quick-menu .help { margin: 8px 10px; }
.quick-item { display: flex; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 8px; text-align: left; align-items: baseline; }
.quick-item:hover, .quick-item:focus-visible { background: var(--green-50); }
.quick-item strong { color: var(--green); flex: none; }
.quick-item span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.kv th { text-transform: none; letter-spacing: 0; font-size: .9rem; background: none; width: 38%; }
table.kv td { word-break: break-word; }
#modal[data-locked="1"]::backdrop { background: #0b1f18d0; }

/* ---------- Estilo mensageiro (WhatsApp/Telegram) ---------- */
.chat { background: var(--chat-bg); }
.chat-header { background: var(--bar); border-bottom: 1px solid var(--border); }
.chat-origin { align-self: center; margin: 10px auto 0; width: fit-content; padding: 4px 12px; border-radius: 8px; background: var(--note-bg); color: var(--note-text); font-size: .78rem; }
.chat-messages { background-color: var(--chat-bg); background-image: radial-gradient(var(--chat-dot) 1.2px, transparent 1.3px), radial-gradient(var(--chat-dot) 1px, transparent 1.1px); background-size: 26px 26px, 26px 26px; background-position: 0 0, 13px 13px; padding: 10px 7% 18px; gap: 3px; }
.chat-date { background: var(--bubble-in); color: var(--bar-text); box-shadow: 0 1px 1px #0b141a1f; font-weight: 500; }
.message { max-width: min(66%, 560px); }
.message-bubble { position: relative; display: flow-root; padding: 6px 9px 7px 10px; background: var(--bubble-in); border: 0; border-radius: 0 8px 8px 8px; box-shadow: 0 1px 1px #0b141a21; white-space: normal; line-height: 1.4; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-bubble::before { content: ''; position: absolute; top: 0; left: -7px; width: 8px; height: 13px; background: var(--bubble-in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.out .message-bubble { background: var(--bubble-out); border: 0; border-radius: 8px 0 8px 8px; }
.out .message-bubble::before { left: auto; right: -7px; background: var(--bubble-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.message.bot .message-bubble, .message.bot .message-bubble::before { background: var(--bot-bg); }
.message-author { margin: 0 0 2px; font-size: .78rem; font-weight: 700; color: var(--author); }
.message.bot .message-author { color: var(--bot); }
.message-meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 7px 0 -3px 12px; font-size: .7rem; color: var(--meta); line-height: 1; }
.tick { font-size: .78rem; letter-spacing: -2px; color: #8696a0; }
.tick.read { color: #53bdeb; }
.tick.bad { color: var(--danger); letter-spacing: 0; font-weight: 800; }
.message-error { margin: 3px 0 0; }
.msg-file { background: var(--chat-dot); border: 0; }
.composer { background: var(--bar); border-top: 0; padding: 8px 14px 6px; }
.composer form { align-items: center; gap: 6px; }
.composer form .icon-btn { border: 0; background: none; color: var(--bar-text); border-radius: 50%; }
.composer form .icon-btn:hover { background: #0b141a12; }
.composer textarea { border: 0; border-radius: 22px; padding: 11px 16px; background: var(--bubble-in); box-shadow: none; }
.composer textarea:focus { outline: 2px solid #1d8a6350; }
.composer #send-button { width: 44px; padding: 0; border-radius: 50%; justify-content: center; }
.composer #send-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.composer-foot { margin-top: 2px; min-height: 0; }
.composer-foot > span:first-child { display: none; }
.composer-foot:has(#char-count:empty) { display: none; }
.conversation-item { border-left-width: 0; border-bottom-color: var(--border-soft); }
.conversation-item:hover { background: var(--hover); }
.conversation-item.selected { background: var(--bar); border-left-color: transparent; }
.conversation-item .avatar { width: 48px; height: 48px; }
@media (max-width: 760px) { .chat-messages { padding: 8px 10px 14px; } .message { max-width: 86%; } }

/* ---------- Temas: claro, escuro e automático (segue o sistema) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --green: #21906f; --green-600: #2aa383; --green-100: #1d3a30; --green-50: #162a23;
  --ink: #e7efeb; --text-2: #b9c8c1; --muted: #93a39b;
  --border: #2c3b35; --border-soft: #223029; --bg: #0f1714; --white: #17211d;
  --warn: #f0c46b; --warn-bg: #3a2e12; --danger: #ff9a9a; --danger-bg: #3d1f1f; --danger-solid: #c0392b;
  --bot: #c9b8f5; --bot-bg: #2b2444; --info: #8fc7ee; --info-bg: #173246;
  --chat-bg: #0b141a; --chat-dot: #ffffff0a; --bubble-in: #202c33; --bubble-out: #005c4b;
  --bar: #202c33; --bar-text: #aebac1; --meta: #8696a0; --author: #06cf9c;
  --note-bg: #182229; --note-text: #ffd279; --surface-2: #121c18; --track: #26352e; --hover: #1b2823;
  --th-bg: #1d2a24; --field-border: #3a4b44; --switch-off: #52625a;
  --shadow: 0 1px 2px #0006, 0 4px 14px #0004;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --green: #21906f; --green-600: #2aa383; --green-100: #1d3a30; --green-50: #162a23;
    --ink: #e7efeb; --text-2: #b9c8c1; --muted: #93a39b;
    --border: #2c3b35; --border-soft: #223029; --bg: #0f1714; --white: #17211d;
    --warn: #f0c46b; --warn-bg: #3a2e12; --danger: #ff9a9a; --danger-bg: #3d1f1f; --danger-solid: #c0392b;
    --bot: #c9b8f5; --bot-bg: #2b2444; --info: #8fc7ee; --info-bg: #173246;
    --chat-bg: #0b141a; --chat-dot: #ffffff0a; --bubble-in: #202c33; --bubble-out: #005c4b;
    --bar: #202c33; --bar-text: #aebac1; --meta: #8696a0; --author: #06cf9c;
    --note-bg: #182229; --note-text: #ffd279; --surface-2: #121c18; --track: #26352e; --hover: #1b2823;
    --th-bg: #1d2a24; --field-border: #3a4b44; --switch-off: #52625a;
    --shadow: 0 1px 2px #0006, 0 4px 14px #0004;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] .login-story { background: linear-gradient(160deg, #0d3b2e 0%, #071f18 100%); }
:root[data-theme="dark"] .toast { background: #26352e; color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-story { background: linear-gradient(160deg, #0d3b2e 0%, #071f18 100%); }
  :root:not([data-theme="light"]) .toast { background: #26352e; color: var(--ink); }
}
#theme-label { font-weight: 600; }

/* ---------- Player de áudio e emojis ---------- */
.voice { display: flex; align-items: center; gap: 10px; min-width: min(280px, 100%); margin-bottom: 2px; }
.voice-play { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-size: 1.1rem; }
.voice-play:hover { background: var(--green-600); }
.voice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 28px; width: 100%; cursor: pointer; }
.voice-bar { flex: 1; min-width: 2px; border-radius: 2px; background: var(--bar-text); opacity: .4; transition: opacity .1s; }
.voice-bar.h0 { height: 22%; }
.voice-bar.h1 { height: 33%; }
.voice-bar.h2 { height: 44%; }
.voice-bar.h3 { height: 55%; }
.voice-bar.h4 { height: 66%; }
.voice-bar.h5 { height: 77%; }
.voice-bar.h6 { height: 88%; }
.voice-bar.h7 { height: 99%; }
.voice-bar.on { opacity: 1; background: var(--green-600); }
.voice-time { font-size: .72rem; color: var(--meta); font-variant-numeric: tabular-nums; }
.voice-speed { flex: none; min-width: 38px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--chat-dot); color: var(--bar-text); font-size: .74rem; font-weight: 700; }
.voice:not(.playing) .voice-speed { opacity: .0; pointer-events: none; }
.voice:hover .voice-speed, .voice-speed:focus-visible { opacity: 1; pointer-events: auto; }
.voice.failed .voice-play, .voice.failed .voice-body, .voice.failed .voice-speed { display: none; }
.voice-fallback { font-weight: 600; color: var(--green); text-decoration: underline; }
.emoji-panel { position: absolute; left: 14px; bottom: calc(100% - 4px); z-index: 8; width: min(340px, calc(100% - 28px)); background: var(--white); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 30px #0b1f1833; overflow: hidden; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--border-soft); background: var(--bar); }
.emoji-tab { flex: 1; min-height: 40px; font-size: 1.15rem; border-bottom: 2px solid transparent; filter: grayscale(.6); }
.emoji-tab[aria-selected="true"] { border-bottom-color: var(--green-600); filter: none; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; max-height: 220px; overflow-y: auto; }
.emoji-grid .help { grid-column: 1 / -1; padding: 12px 6px; text-align: center; }
.emoji-item { height: 36px; border-radius: 8px; font-size: 1.35rem; line-height: 1; }
.emoji-item:hover, .emoji-item:focus-visible { background: var(--hover); }

/* ---------- Respostas rápidas ---------- */
.quick-menu { padding: 6px; }
.quick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 6px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }
.quick-head strong { font-size: .9rem; }
.quick-row { display: flex; align-items: center; gap: 2px; }
.quick-row .quick-item { flex: 1; min-width: 0; }
.quick-own { flex: none; font-style: normal; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--green-100); color: var(--green); }
.quick-send { flex: none; width: 36px; height: 36px; border: 0; background: none; color: var(--green-600); border-radius: 50%; }
.quick-send:hover, .quick-send:focus-visible { background: var(--green); color: #fff; }
.quick-foot { padding: 6px 8px 2px; font-size: .75rem; color: var(--muted); }
.quick-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 8px; }
.quick-chip { max-width: 100%; padding: 4px 12px; min-height: 30px; border-radius: 99px; background: var(--bubble-in); color: var(--green); font-size: .82rem; font-weight: 700; box-shadow: 0 1px 1px #0b141a21; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-chip:hover, .quick-chip:focus-visible { background: var(--green); color: #fff; }
@media (max-width: 760px) { .quick-foot { display: none; } }
