/* Identidade FENE (preto e branco) no sistema; área da conversa no estilo do WhatsApp.
   Layout: menu preto à esquerda · lista de conversas · conversa aberta. Painel admin com menu lateral próprio. */
:root {
  /* neutros */
  --paper: #EFF0F1;
  --panel: #FFFFFF;
  --panel-head: #F0F2F5;
  --ink: #111B21;
  --ink-2: #3B4A54;
  --muted: #667781;
  --line: #E9EDEF;
  --line-strong: #D1D7DB;
  --sel: #F0F2F5;
  --hover: #F5F6F6;
  --input: #FFFFFF;
  /* marca FENE: preto e branco */
  --brand: #111111;
  --brand-hover: #2E2E2E;
  --brand-ink: #FFFFFF;
  --brand-soft: #ECECEC;
  --brand-soft-ink: #111111;
  --focus: #111111;
  --chrome: #111111;          /* menu lateral, faixa da entrada */
  --chrome-ink: #FFFFFF;
  --chrome-muted: #A3A3A3;
  --chrome-hover: rgba(255, 255, 255, .08);
  --chrome-active: rgba(255, 255, 255, .14);
  --chrome-line: rgba(255, 255, 255, .12);
  /* WhatsApp: só na área das conversas */
  --wa: #008069;
  --wa-hover: #017561;
  --wa-ink: #FFFFFF;
  --wa-soft: #D9FDD3;
  --wa-soft-ink: #027A5E;
  --green: #00A884;
  --wall: #EFEAE2;
  --wall-dot: rgba(84, 101, 111, .07);
  --bubble-in: #FFFFFF;
  --bubble-out: #D9FDD3;
  --tick-read: #53BDEB;
  --mobile-head: #008069;
  --mobile-head-ink: #FFFFFF;
  /* estados */
  --danger: #D2003A;
  --danger-soft: #FFE6EB;
  --warn: #9A6400;
  --warn-soft: #FFF1CF;
  --ok: #027A5E;
  --ok-soft: #E3F7EE;
  --shadow: 0 2px 5px rgba(11, 20, 26, .1), 0 8px 28px rgba(11, 20, 26, .12);
  --bubble-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --radius-s: 6px;
  --radius-m: 8px;
  --radius-l: 12px;
  --font: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0C1317; --panel: #111B21; --panel-head: #202C33; --ink: #E9EDEF; --ink-2: #D1D7DB; --muted: #8696A0;
    --line: #222D34; --line-strong: #2A3942; --sel: #2A3942; --hover: #202C33; --input: #2A3942;
    --brand: #F2F2F2; --brand-hover: #FFFFFF; --brand-ink: #111111; --brand-soft: #2B2F33; --brand-soft-ink: #F2F2F2; --focus: #F2F2F2;
    --chrome: #050505; --chrome-ink: #FFFFFF; --chrome-muted: #9A9A9A; --chrome-hover: rgba(255,255,255,.07); --chrome-active: rgba(255,255,255,.13); --chrome-line: rgba(255,255,255,.1);
    --wa: #00A884; --wa-hover: #06CF9C; --wa-ink: #111B21; --wa-soft: #103529; --wa-soft-ink: #00A884;
    --green: #00A884; --wall: #0B141A; --wall-dot: rgba(233, 237, 239, .035);
    --bubble-in: #202C33; --bubble-out: #005C4B; --tick-read: #53BDEB; --mobile-head: #202C33; --mobile-head-ink: #E9EDEF;
    --danger: #F15C6D; --danger-soft: #3B1E25; --warn: #FFC85A; --warn-soft: #3A3016; --ok: #06CF9C; --ok-soft: #0F2E26;
    --shadow: 0 2px 5px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.4); --bubble-shadow: 0 1px .5px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0C1317; --panel: #111B21; --panel-head: #202C33; --ink: #E9EDEF; --ink-2: #D1D7DB; --muted: #8696A0;
  --line: #222D34; --line-strong: #2A3942; --sel: #2A3942; --hover: #202C33; --input: #2A3942;
  --brand: #F2F2F2; --brand-hover: #FFFFFF; --brand-ink: #111111; --brand-soft: #2B2F33; --brand-soft-ink: #F2F2F2; --focus: #F2F2F2;
  --chrome: #050505; --chrome-ink: #FFFFFF; --chrome-muted: #9A9A9A; --chrome-hover: rgba(255,255,255,.07); --chrome-active: rgba(255,255,255,.13); --chrome-line: rgba(255,255,255,.1);
  --wa: #00A884; --wa-hover: #06CF9C; --wa-ink: #111B21; --wa-soft: #103529; --wa-soft-ink: #00A884;
  --green: #00A884; --wall: #0B141A; --wall-dot: rgba(233, 237, 239, .035);
  --bubble-in: #202C33; --bubble-out: #005C4B; --tick-read: #53BDEB; --mobile-head: #202C33; --mobile-head-ink: #E9EDEF;
  --danger: #F15C6D; --danger-soft: #3B1E25; --warn: #FFC85A; --warn-soft: #3A3016; --ok: #06CF9C; --ok-soft: #0F2E26;
  --shadow: 0 2px 5px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.4); --bubble-shadow: 0 1px .5px rgba(0,0,0,.25);
  color-scheme: dark;
}

/* Dentro da área de conversas (e nos avisos de mensagem), as cores de destaque voltam a ser as do WhatsApp. */
.inbox, .popups {
  --brand: var(--wa); --brand-hover: var(--wa-hover); --brand-ink: var(--wa-ink);
  --brand-soft: var(--wa-soft); --brand-soft-ink: var(--wa-soft-ink); --focus: var(--wa);
}

/* ───────────── base ───────────── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14.5px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.s { width: 17px; height: 17px; }
.icon.xs { width: 13px; height: 13px; }
.muted { color: var(--muted); margin: 0; }
.link { font-size: 13.5px; font-weight: 600; text-decoration: none; color: var(--brand); }
.link:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--brand); cursor: pointer; font-weight: 600; white-space: nowrap; font-size: 14px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn.wide { height: 42px; justify-content: center; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input { height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-m); background: var(--input); width: 100%; }
textarea.input { height: auto; padding: 9px 12px; resize: vertical; min-height: 70px; }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 1px var(--brand); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-head); color: var(--ink-2); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--brand-soft); color: var(--brand-soft-ink); }

.avatar { width: 49px; height: 49px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 16px; flex: none; color: #fff; object-fit: cover; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.s { width: 28px; height: 28px; font-size: 11px; }
.avatar.l { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 104px; height: 104px; font-size: 34px; }
.avatar.group { background: #DFE5E7 !important; color: #8696A0; }
.avatar.photo { background: var(--panel-head); }

.error-text { color: var(--danger); font-size: 13.5px; margin: 0; }
.error-text:empty { display: none; }
.empty { display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); padding: 40px 24px; gap: 8px; }
.empty strong { color: var(--ink-2); font-weight: 600; }

/* ───────────── login ───────────── */
.login { min-height: 100%; background: var(--paper); position: relative; padding: 0 16px 40px; display: flow-root; }
.login-top { position: absolute; inset: 0 0 auto; height: 222px; background: var(--chrome); padding: 28px max(16px, calc(50% - 470px)); }
.login-logo { height: 44px; width: auto; display: block; }
.login-mark { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.mark-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.login-card { position: relative; max-width: 940px; margin: 92px auto 0; background: var(--panel); border-radius: 4px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; padding: 52px 56px; }
.login-info h1 { margin: 0 0 12px; font-size: 26px; font-weight: 300; color: var(--ink); text-wrap: balance; }
.login-info p { margin: 0 0 22px; color: var(--ink-2); max-width: 44ch; }
.login-preview { background-color: var(--wall); background-image: radial-gradient(var(--wall-dot) 1.2px, transparent 1.6px); background-size: 16px 16px;
  border-radius: var(--radius-l); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.login-preview .msg { max-width: 86%; }
.login-form { display: grid; gap: 16px; align-content: center; }
.login-form h2 { margin: 0; font-size: 20px; font-weight: 400; }
.quick { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.quick p { margin: 0; font-size: 13px; color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-grid button { text-align: left; padding: 8px 12px; border-radius: var(--radius-m); border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; display: grid; }
.quick-grid button:hover { border-color: var(--brand); background: var(--hover); }
.quick-grid b { font-weight: 600; font-size: 14px; }
.quick-grid span { font-size: 12.5px; color: var(--muted); }

/* ───────────── estrutura ───────────── */
.shell { height: 100%; display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.banner { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 9px 16px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner .btn { margin-left: auto; }
.rail { grid-row: 2; background: var(--chrome); color: var(--chrome-ink); border-right: 1px solid var(--chrome-line); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; min-height: 0; }
.rail-logo { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 12px; flex: none; }
.rail-logo img { height: 36px; width: auto; display: block; }
.rail a { width: 68px; padding: 8px 0 6px; border-radius: var(--radius-m); display: grid; justify-items: center; gap: 2px; color: var(--chrome-muted); text-decoration: none; font-size: 10.5px; font-weight: 600; position: relative; }
.rail a:hover { color: var(--chrome-ink); background: var(--chrome-hover); }
.rail a[aria-current="page"] { color: var(--chrome-ink); background: var(--chrome-active); }
.rail :focus-visible { outline-color: var(--chrome-ink); }
.rail .dot { position: absolute; top: 3px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.rail-bottom { margin-top: auto; display: grid; justify-items: center; gap: 6px; }
.me-btn { border: 0; background: none; padding: 2px; border-radius: 999px; cursor: pointer; display: flex; align-items: center; gap: 10px; color: inherit; text-align: left; }
.me-btn .avatar { width: 36px; height: 36px; font-size: 13px; }
.me-btn:hover .avatar { box-shadow: 0 0 0 2px var(--chrome-ink); }
.me-text { display: grid; min-width: 0; }
.me-text b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--chrome-muted); font-size: 12px; }
.main { grid-row: 2; min-width: 0; min-height: 0; display: flex; }

/* painel administrador: menu lateral largo, com nomes */
.shell.area-admin { grid-template-columns: 240px minmax(0, 1fr); }
.area-admin .rail { align-items: stretch; padding: 20px 12px 16px; gap: 18px; }
.admin-brand { display: grid; gap: 8px; padding: 0 10px 4px; }
.admin-brand img { height: 34px; width: auto; justify-self: start; }
.admin-brand .rail-logo { margin: 0; }
.admin-brand b { display: block; font-size: 15px; }
.admin-brand small { color: var(--chrome-muted); font-size: 12px; letter-spacing: .02em; }
.admin-nav { display: grid; gap: 2px; }
.admin-nav p { margin: 0 0 4px 10px; font-size: 12px; color: var(--chrome-muted); font-weight: 600; }
.area-admin .rail a { width: auto; display: flex; align-items: center; gap: 12px; padding: 9px 10px; font-size: 14.5px; font-weight: 500; color: var(--chrome-muted); }
.area-admin .rail a[aria-current="page"] { background: var(--chrome-active); color: var(--chrome-ink); }
.area-admin .rail .dot { position: static; margin-left: auto; }
.admin-switch { border-top: 1px solid var(--chrome-line); padding-top: 14px; }
.area-admin .rail-bottom { justify-items: stretch; border-top: 1px solid var(--chrome-line); padding-top: 12px; }
.area-admin .rail-bottom .me-btn { padding: 6px; border-radius: var(--radius-m); }
.area-admin .rail-bottom .me-btn:hover { background: var(--chrome-hover); }

/* ───────────── conversas ───────────── */
.inbox { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); width: 100%; min-height: 0; }
.list-pane { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 12px 16px 8px; display: grid; gap: 10px; }
.list-head-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.list-head h1 { font-size: 22px; margin: 0; font-weight: 700; }
.list-head-row .btn { margin-left: auto; }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 10px; color: var(--muted); }
.search .input { padding-left: 44px; background: var(--panel-head); border-color: transparent; height: 36px; border-radius: var(--radius-m); }
.search .input:focus { box-shadow: none; border-color: transparent; background: var(--panel-head); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { height: 32px; padding: 0 13px; border: 0; background: var(--panel-head); border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.chips button:hover { background: color-mix(in srgb, var(--panel-head) 70%, var(--line-strong)); }
.chips button[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-soft-ink); font-weight: 600; }
.chips .count { font-size: 12px; font-weight: 700; }
.list-filter { display: flex; gap: 8px; }
.list-filter select { height: 34px; font-size: 13.5px; background: var(--panel); }
.list { overflow-y: auto; flex: 1; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 0 0 0 14px; cursor: pointer; background: var(--panel); text-align: left; width: 100%; border: 0; align-items: center; min-height: 72px; }
.item:hover { background: var(--hover); }
.item[aria-current="true"] { background: var(--sel); }
.item-body { min-width: 0; border-bottom: 1px solid var(--line); padding: 12px 16px 12px 0; align-self: stretch; display: grid; align-content: center; }
.item-top { display: flex; gap: 8px; align-items: baseline; }
.item-title { font-size: 16.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-time { margin-left: auto; font-size: 12px; color: var(--muted); flex: none; }
.item-prev { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.item-meta { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.owner { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative;
  background-color: var(--wall); background-image: radial-gradient(var(--wall-dot) 1.2px, transparent 1.6px); background-size: 18px 18px; }
.chat-head { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel-head); min-height: 60px; flex-wrap: wrap; border-left: 1px solid var(--line); }
.chat-head > .avatar { width: 42px; height: 42px; }
.chat-head .who { min-width: 0; display: grid; flex: 1; }
.chat-head .who b { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { display: none; }
.stamp { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--panel); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.stamp.queue { padding-left: 10px; background: var(--warn-soft); color: var(--warn); }

.messages { flex: 1; overflow-y: auto; padding: 16px clamp(16px, 6vw, 72px) 10px; display: flex; flex-direction: column; gap: 2px; }
.day { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--panel); padding: 5px 12px; border-radius: 8px; margin: 12px 0 8px; box-shadow: var(--bubble-shadow); text-transform: uppercase; }
.event { align-self: center; max-width: 85%; text-align: center; font-size: 12.5px; color: var(--ink-2); background: color-mix(in srgb, var(--panel) 90%, transparent); padding: 5px 12px; margin: 6px 0; border-radius: 8px; box-shadow: var(--bubble-shadow); display: flex; gap: 6px; align-items: center; }
.event .icon { color: var(--muted); }
.msg { max-width: min(560px, 75%); display: grid; gap: 2px; position: relative; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; }
.msg.first { margin-top: 8px; }
.bubble { position: relative; padding: 6px 8px 8px 9px; border-radius: 8px; background: var(--bubble-in); box-shadow: var(--bubble-shadow); overflow-wrap: anywhere; white-space: pre-wrap; color: var(--ink); font-size: 14.2px; line-height: 19px; }
.msg.out .bubble { background: var(--bubble-out); }
/* rabinho do balão na primeira mensagem de cada sequência */
.msg.first.in .bubble { border-top-left-radius: 0; }
.msg.first.out .bubble { border-top-right-radius: 0; }
.msg.first.in .bubble::before, .msg.first.out .bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
.msg.first.in .bubble::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg.first.out .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg-author { display: flex; align-items: center; gap: 6px; font-size: 12.8px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; color: var(--who, var(--brand-soft-ink)); }
.msg.out .msg-author { color: var(--brand-soft-ink); }
.msg-author small { font-weight: 400; color: var(--muted); }
.msg-author.phone-origin { color: var(--muted); font-weight: 500; }
.text { white-space: pre-wrap; }
.spacer { display: inline-block; width: 46px; height: 1px; }
.spacer.tick { width: 66px; }
.spacer.edited { width: 98px; }
.spacer.tick.edited { width: 118px; }
.bubble-foot { position: absolute; right: 7px; bottom: 3px; display: inline-flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.msg.out .bubble-foot { color: color-mix(in srgb, var(--ink) 50%, var(--bubble-out)); }
.tick { display: inline-flex; color: var(--muted); }
.tick .icon { width: 16px; height: 16px; }
.tick.lida { color: var(--tick-read); }
.tick.erro { color: var(--danger); }
.bubble img.media { display: block; max-width: 100%; max-height: 330px; border-radius: 6px; margin: 0 0 4px; cursor: zoom-in; }
.bubble audio, .bubble video { display: block; max-width: 100%; margin: 2px 0 6px; }
.doc { display: flex; gap: 8px; align-items: center; padding: 10px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 6%, transparent); text-decoration: none; color: inherit; margin: 0 0 4px; }
.edited-btn { border: 0; background: none; padding: 0; color: inherit; font-size: 11px; cursor: pointer; text-decoration: underline dotted; }
.msg-tools { position: absolute; top: 4px; right: calc(100% + 6px); opacity: 0; transition: opacity .12s; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; }
.msg-tools .icon-btn { width: 30px; height: 30px; background: var(--panel); box-shadow: var(--bubble-shadow); }
.msg-tools .icon-btn:hover { color: var(--danger); }
.err-note { font-size: 12px; color: var(--danger); text-align: right; }

/* mensagem apagada: continua visível, com aviso */
.msg.deleted .bubble { background: color-mix(in srgb, var(--danger-soft) 70%, var(--bubble-in)); box-shadow: var(--bubble-shadow), inset 0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent); }
.msg.out.deleted .bubble { background: color-mix(in srgb, var(--danger-soft) 55%, var(--bubble-out)); }
.deleted-tag { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-style: italic; color: var(--danger); margin-bottom: 3px; white-space: normal; }
.deleted-empty { font-style: italic; color: var(--muted); }

.composer { background: var(--panel-head); padding: 8px 16px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: var(--radius-m); padding: 10px 14px; max-height: 160px; min-height: 42px; line-height: 1.4; background: var(--input); }
.composer textarea:focus { outline: none; }
.composer .send { height: 42px; width: 42px; padding: 0; justify-content: center; border-radius: 50%; }
.composer label.icon-btn { flex: none; }
.attach-chip { display: flex; gap: 8px; align-items: center; padding: 6px 16px; background: var(--panel-head); font-size: 13.5px; border-bottom: 1px solid var(--line); }
.locked { padding: 14px 16px; background: var(--panel-head); display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.locked .btn { margin-left: auto; }
.sign-note { font-size: 11.5px; color: var(--muted); padding: 0 16px 6px 70px; background: var(--panel-head); }

/* gavetas, menus e diálogos */
.drawer-scrim { position: fixed; inset: 0; background: rgba(11, 20, 26, .35); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(420px, 100%); height: 100%; background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 14px 20px; background: var(--panel-head); }
.drawer-head h2 { margin: 0; font-size: 17px; font-weight: 500; }
.drawer-head .icon-btn { margin-left: auto; }
.drawer-body { padding: 20px; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.drawer h3 { margin: 0 0 8px; font-size: 14px; color: var(--brand-soft-ink); font-weight: 600; }
.rows { display: grid; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row small { display: block; color: var(--muted); font-size: 12.5px; }
.note { font-size: 13.5px; color: var(--ink-2); background: var(--panel-head); border-radius: var(--radius-m); padding: 10px 12px; margin: 0; }
.note.danger { background: var(--danger-soft); color: var(--danger); display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }

.photo-field { display: flex; gap: 16px; align-items: center; }
.photo-actions { display: grid; gap: 6px; justify-items: start; }
.photo-actions small { color: var(--muted); font-size: 12px; max-width: 30ch; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border-radius: var(--radius-m); box-shadow: var(--shadow); min-width: 250px; z-index: 70; /* acima dos pop-ups de aviso */ padding: 8px 0; max-height: 380px; overflow-y: auto; }
.menu p { margin: 2px 16px 8px; font-size: 12.5px; color: var(--muted); }
.menu button { display: flex; width: 100%; gap: 12px; align-items: center; padding: 9px 16px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 14.5px; }
.menu button:hover, .menu button:focus-visible { background: var(--hover); }
.menu button[disabled] { opacity: .55; cursor: default; }
.menu button small { margin-left: auto; color: var(--muted); font-size: 12px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.dialog-scrim { position: fixed; inset: 0; background: rgba(11, 20, 26, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { background: var(--panel); border-radius: 3px; width: min(460px, 100%); padding: 22px 24px 18px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.dialog h2 { margin: 0; font-size: 18px; font-weight: 500; }
.dialog p { margin: 0; color: var(--muted); }
.dialog .foot { display: flex; justify-content: flex-end; gap: 8px; }
.history { display: grid; gap: 10px; }
.history div { padding: 10px 12px; background: var(--panel-head); border-radius: var(--radius-m); white-space: pre-wrap; }
.history small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #3B4A54; color: #fff; padding: 11px 18px; border-radius: var(--radius-m); font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--danger); color: #fff; }

/* ───────────── páginas: administração e supervisão ───────────── */
.page { flex: 1; overflow-y: auto; padding: 28px clamp(16px, 4vw, 44px) 48px; background: var(--paper); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 64ch; }
.page-head .btn { margin-left: auto; }
.table-wrap { background: var(--panel); border-radius: var(--radius-l); overflow-x: auto; box-shadow: var(--bubble-shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.muted { color: var(--muted); }
tr.inactive td { opacity: .55; }
.user-cell { display: flex; gap: 12px; align-items: center; }
.user-cell .avatar { width: 40px; height: 40px; }
.user-cell small { display: block; color: var(--muted); font-size: 12.5px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border-radius: var(--radius-l); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--bubble-shadow); }
.stat b { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.warn b { color: var(--warn); }
.stat.danger b { color: var(--danger); }
.sv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.sv-grid > * { min-width: 0; }
.panel { background: var(--panel); border-radius: var(--radius-l); padding: 16px 18px; box-shadow: var(--bubble-shadow); display: grid; gap: 12px; margin-bottom: 16px; min-width: 0; }
.sv-grid .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.panel-head > :last-child:not(h2) { margin-left: auto; }
.panel-head small { color: var(--muted); }
.srows { display: grid; }
.srow { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 6px 0; }
.srow:last-child { border-bottom: 0; }
.srow-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; border: 0; background: none; text-align: left; cursor: pointer; padding: 4px; border-radius: var(--radius-m); color: inherit; text-decoration: none; }
.srow-main:hover { background: var(--hover); }
.srow-main .avatar { width: 40px; height: 40px; font-size: 14px; }
.srow-main .grow { min-width: 0; display: grid; }
.srow-main b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-main small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-side { display: flex; gap: 8px; align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.member { border: 1px solid var(--line); border-radius: var(--radius-l); padding: 14px; display: grid; gap: 12px; align-content: start; }
.member.has-wait { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.member-head { display: flex; gap: 12px; align-items: center; }
.member-head .grow { min-width: 0; display: grid; }
.member-head b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-head small { color: var(--muted); font-size: 12.5px; }
.member-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.member-stats div { display: grid; }
.member-stats dt { color: var(--muted); font-size: 12px; }
.member-stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.member-stats dd small { font-size: 12px; font-weight: 500; }
.member-stats .wait.danger dd { color: var(--danger); }
.member-stats .wait.warn dd { color: var(--warn); }
.member .btn { justify-self: start; }
.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.face { border: 0; background: none; display: grid; justify-items: center; gap: 4px; cursor: pointer; padding: 8px 4px; border-radius: var(--radius-m); }
.face:hover { background: var(--hover); }
.face span { font-size: 13px; font-weight: 600; }
.face small { font-size: 11.5px; color: var(--muted); }
.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.activity li:last-child { border-bottom: 0; }
.activity .when { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 40px; }
.activity small { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border-radius: var(--radius-l); padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; box-shadow: var(--bubble-shadow); }
.card-head { display: flex; gap: 10px; align-items: center; }
.card-head b { font-size: 16px; }
.card-head .pill { margin-left: auto; }
.card .phone { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .muted { color: var(--muted); font-size: 13.5px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qr { display: grid; justify-items: center; gap: 10px; padding: 16px; background: var(--panel-head); border-radius: var(--radius-m); }
.qr img, .qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 6px; }
.qr p { margin: 0; text-align: center; font-size: 13.5px; color: var(--ink-2); max-width: 32ch; }

.settings { display: grid; gap: 12px; max-width: 660px; }
.setting { background: var(--panel); border-radius: var(--radius-l); padding: 16px; box-shadow: var(--bubble-shadow); }
.setting .check b { display: block; font-weight: 600; }
.setting .check span { color: var(--muted); font-size: 14px; }

.sim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.sim-grid > * { min-width: 0; }
.sim-card { background: var(--panel); border-radius: var(--radius-l); padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; box-shadow: var(--bubble-shadow); min-width: 0; }
.sim-card .field { min-width: 0; }
.sim-card select.input { max-width: 100%; }
.sim-card h2 { margin: 0; font-size: 16px; font-weight: 600; }
.sim-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sim-msg { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius-m); background: var(--panel-head); font-size: 13.5px; }
.sim-msg span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-msg.del span { text-decoration: line-through; color: var(--muted); }
.sim-msg .btn { flex: none; }
.sim-head { display: flex; gap: 12px; align-items: center; background: var(--panel); border-radius: var(--radius-l); padding: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; box-shadow: var(--bubble-shadow); }
.sim-head select { width: auto; }

/* ───────────── avisos: pop-ups e aceite ───────────── */
.popups { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); top: 72px; z-index: 55; display: grid; gap: 10px; width: min(360px, calc(100% - 32px)); }
.popup { background: var(--panel); border-radius: var(--radius-l); box-shadow: var(--shadow); position: relative; overflow: hidden; animation: pop-in .2s ease-out; border-left: 4px solid var(--green); }
.popup.offer { border-left-color: var(--warn); }
@keyframes pop-in { from { transform: translateY(-12px); opacity: 0; } }
.popup-main { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 40px 12px 12px; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; }
.popup-main:hover { background: var(--hover); }
.popup-text { display: grid; min-width: 0; gap: 1px; }
.popup-text b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popup-text small { color: var(--brand-soft-ink); font-size: 12.5px; font-weight: 600; }
.popup-text span { color: var(--muted); font-size: 13.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.popup-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; }
.popup-actions { display: flex; gap: 8px; padding: 0 12px 12px 68px; }
.pill.accept { background: var(--brand-soft); color: var(--brand-soft-ink); }
.item.pending { background: color-mix(in srgb, var(--brand-soft) 45%, var(--panel)); }
.item.pending .item-title { font-weight: 600; }
.stamp.pending { background: var(--warn-soft); color: var(--warn); }
.accept-bar { background: var(--panel-head); padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 3px solid var(--green); }
.accept-bar > div:first-child { flex: 1; min-width: 220px; font-size: 14px; color: var(--ink-2); }
.accept-actions { display: flex; gap: 8px; }
.pref-group { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.pref-group h3 { margin: 0; }
.sound-row { display: flex; gap: 8px; align-items: center; }
.sound-row select { flex: 1; min-width: 0; }
.range { width: 100%; accent-color: var(--brand); }
.os-notify { display: grid; gap: 6px; justify-items: start; }
.os-notify small { color: var(--muted); font-size: 12.5px; }
.to-accept { color: var(--warn); font-size: 12px; font-weight: 600; }

/* ───────────── departamentos ───────────── */
.pill.dept { background: color-mix(in srgb, var(--brand-soft) 60%, var(--panel-head)); color: var(--brand-soft-ink); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills .pill { height: auto; min-height: 22px; padding: 2px 9px; white-space: normal; }
h3.mini { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.member-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--panel-head); font-size: 13px; font-weight: 500; }
.face-stack { display: flex; }
.face-stack .avatar { width: 26px; height: 26px; margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.face-stack .avatar:first-child { margin-left: 0; }
.dept-filter { width: auto; min-width: 220px; margin-left: auto; }
.dept-box { border: 0; padding: 0; margin: 0; }
.dept-box legend { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.dept-card .card-head .pill { margin-left: auto; }
.list-filter select { flex: 1; min-width: 0; }

/* ───────────── Conexão QR Code ───────────── */
.area-admin .rail a.sub { margin-left: 22px; padding-left: 12px; font-size: 14px; border-left: 2px solid var(--chrome-line); border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.area-admin .rail a.sub[aria-current="page"] { border-left-color: var(--chrome-ink); }
.dialog.wizard { width: min(760px, 100%); padding: 0; gap: 0; max-height: calc(100% - 32px); overflow: auto; border-radius: var(--radius-l); }
.wizard-head { display: flex; align-items: center; padding: 16px 16px 8px 24px; }
.wizard-head .icon-btn { margin-left: auto; }
.wizard-steps { list-style: none; display: flex; gap: 8px; margin: 0; padding: 4px 24px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wizard-steps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.wizard-steps li + li::before { content: ""; width: 28px; height: 2px; background: var(--line-strong); margin-right: 4px; }
.wizard-steps li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-head); font-size: 12px; font-weight: 700; }
.wizard-steps li.current { color: var(--ink); }
.wizard-steps li.current span { background: var(--brand); color: var(--brand-ink); }
.wizard-steps li.done span { background: var(--brand-soft); color: var(--brand-soft-ink); }
.wizard-body { padding: 20px 24px 20px; display: grid; gap: 16px; }
.wizard-body .foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.qr-step { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
.qr.big { padding: 18px; background: var(--panel-head); }
.qr.big img, .qr.big svg { width: 264px; height: 264px; }
.qr-wait { width: 264px; height: 264px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); background: var(--panel); border-radius: 6px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qr-help { display: grid; gap: 12px; align-content: start; }
.qr-help p { margin: 0; }
.qr-help .btn { justify-self: start; }
.how { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); line-height: 1.45; }
.done-step { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 16px 0 4px; }
.done-step h3 { margin: 4px 0 0; font-size: 20px; font-weight: 600; }
.done-step p { margin: 0; max-width: 46ch; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.done-icon .icon { width: 34px; height: 34px; stroke-width: 2.4; }
.dep-groups { display: grid; gap: 22px; }
.dep-group { display: grid; gap: 12px; }
.dep-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dep-group-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dep-group-head small { color: var(--muted); }
.dep-group-head .btn { margin-left: auto; }
.dep-empty { padding: 14px 16px; background: var(--panel); border-radius: var(--radius-l); border: 1px dashed var(--line-strong); }

/* ───────────── etiquetas ───────────── */
.t-verde { --tc: #1E9E57; } .t-azul { --tc: #2F6FD6; } .t-amarelo { --tc: #C98A00; } .t-laranja { --tc: #E0662B; }
.t-vermelho { --tc: #D2363F; } .t-roxo { --tc: #7B4FD0; } .t-rosa { --tc: #D2458C; } .t-cinza { --tc: #6B7B86; }
.t-verde-claro { --tc: #6BAF2E; } .t-azul-claro { --tc: #1C9BD6; } .t-turquesa { --tc: #0F9C93; } .t-dourado { --tc: #A8801A; }
.t-marrom { --tc: #8A5A3B; } .t-vinho { --tc: #9B2342; } .t-lilas { --tc: #A46BD6; } .t-preto { --tc: #2B3238; }
.t-verde-escuro { --tc: #13703D; } .t-oliva { --tc: #7D8A1C; } .t-ciano { --tc: #06A9C2; } .t-azul-marinho { --tc: #1E3A8A; }
.t-indigo { --tc: #4F46C8; } .t-ameixa { --tc: #6E2A72; } .t-magenta { --tc: #C2189B; } .t-coral { --tc: #F06A5A; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px 0 7px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--tc, #6B7B86) 15%, var(--panel)); color: color-mix(in srgb, var(--tc, #6B7B86) 78%, var(--ink)); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc, #6B7B86); flex: none; }
.tag.more { background: var(--panel-head); color: var(--muted); padding: 0 7px; }
.tag-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 3px; opacity: .7; }
.tag-x:hover { opacity: 1; }
.item-tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.head-tags { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; padding-left: 56px; }
.tag-menu { min-width: 260px; }
.menu-check { display: flex; align-items: center; gap: 10px; padding: 7px 16px; cursor: pointer; }
.menu-check:hover { background: var(--hover); }
.menu-check input { width: 17px; height: 17px; accent-color: var(--brand); }
.list-filter { flex-wrap: wrap; }
.list-filter select { flex: 1 1 140px; }
.list-filter select.on { border-color: var(--brand); color: var(--brand-soft-ink); font-weight: 600; background: color-mix(in srgb, var(--brand-soft) 40%, var(--panel)); }
.clear-filters { height: 34px; }
.swatches { display: grid; grid-template-columns: repeat(8, 34px); gap: 10px; }
@media (max-width: 420px) { .swatches { grid-template-columns: repeat(6, 34px); } }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--tc); cursor: pointer; display: grid; place-items: center; position: relative; }
.swatch input { appearance: none; width: 100%; height: 100%; margin: 0; border-radius: 50%; cursor: pointer; }
.swatch input:checked { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--tc); }
.swatch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.tag-preview { padding: 12px; background: var(--panel-head); border-radius: var(--radius-m); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ───────────── atendimentos em lote ───────────── */
.atd-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.atd-filters .search { flex: 2 1 260px; }
.atd-filters .search .input { background: var(--panel); border-color: var(--line-strong); height: 38px; }
.atd-filters select { flex: 1 1 170px; width: auto; }
.atd-filters select.on { border-color: var(--brand); font-weight: 600; }
.bulk-bar { position: sticky; top: -28px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px;
  background: var(--panel); border-radius: var(--radius-l); box-shadow: var(--bubble-shadow); min-height: 52px; }
.bulk-bar.active { background: var(--chrome); color: var(--chrome-ink); }
.bulk-bar.active > b { margin-right: 6px; }
.bulk-bar.active .btn { background: transparent; color: var(--chrome-ink); border-color: var(--chrome-line); }
.bulk-bar.active .btn:hover { background: var(--chrome-hover); }
.bulk-bar.active .btn.primary { background: var(--chrome-ink); color: var(--chrome); border-color: var(--chrome-ink); }
.bulk-bar.active .btn.danger { color: #FF8A95; }
.bulk-bar .menu { left: 0; right: auto; color: var(--ink); }
.atd-table td.cb, .atd-table th.cb { width: 40px; padding-right: 0; }
.atd-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.atd-table tr.selected td { background: color-mix(in srgb, var(--brand) 6%, var(--panel)); }
.atd-table .user-cell .avatar { width: 32px; height: 32px; font-size: 12px; }
.nowrap { white-space: nowrap; }
.menu button .grow { flex: 1; min-width: 0; display: grid; }
.menu button .menu-sub { color: var(--muted); font-size: 12px; margin-left: 0; display: block; }
.menu-note { font-size: 12px; color: var(--muted); margin: 8px 16px 4px !important; max-width: 34ch; }
.handoff-options { display: grid; gap: 12px; padding: 4px 0; }
.handoff-options .check b { display: block; }
.handoff-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.handoff-note span { flex: 1; min-width: 180px; }
.muted.small { font-size: 12.5px; }

/* ───────────── contato ───────────── */
.avatar-btn { border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--brand); }
.chat-head > .avatar-btn .avatar { width: 42px; height: 42px; }
.btn.contact-new { border-color: var(--brand); }
.contact-head { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--panel-head); border-radius: var(--radius-m); }
.contact-head b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.contact-head small { color: var(--muted); font-size: 13px; }
.field .counter { justify-self: end; font-variant-numeric: tabular-nums; }
textarea#ct-notes { min-height: 140px; line-height: 1.45; }

/* ───────────── contatos ───────────── */
.ct-table .ct-name { font-weight: 600; }
.ct-table td.ct-notes { max-width: 320px; }
.ct-table td.ct-notes span:not(.muted) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; color: var(--ink-2); white-space: pre-line; }
.ct-table tr.blocked-row td { background: color-mix(in srgb, var(--danger-soft) 45%, var(--panel)); }
.tnum { font-variant-numeric: tabular-nums; }
.ct-table .user-cell > div { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px; }
.ct-table .user-cell small { flex-basis: 100%; }
.ct-table .owner { white-space: nowrap; }
.ct-actions { gap: 2px; justify-content: flex-end; flex-wrap: nowrap; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn.on { color: var(--danger); }
.m-only, .ct-table .user-cell .m-only { display: none; }
.ct-table td.ct-date span, .ct-table td.ct-date small { display: block; }
.ct-table td.ct-date small { color: var(--muted); font-size: 12.5px; }
.ct-table .user-cell small.ct-phone { color: var(--ink); font-size: 13.5px; white-space: nowrap; }
.locked.blocked { background: var(--danger-soft); color: var(--danger); }
.atd-filters .chips { align-items: center; }

/* ───────────── automação: mensagens automáticas, respostas rápidas ───────────── */
.msg-author.auto-origin { color: var(--muted); font-weight: 500; }
.msg.auto .bubble { background: color-mix(in srgb, var(--bubble-out) 55%, var(--panel)); }
.composer-zone { position: relative; }
.qr-pop { position: absolute; left: 16px; right: 16px; bottom: calc(100% + 6px); background: var(--panel); border-radius: var(--radius-l); box-shadow: var(--shadow);
  max-height: 300px; overflow-y: auto; padding: 6px; z-index: 30; display: grid; gap: 2px; }
.qr-pop[hidden] { display: none; }
.qr-item { display: grid; gap: 2px; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: var(--radius-m); cursor: pointer; color: var(--ink); }
.qr-item b { font-size: 13px; color: var(--wa); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.qr-item span { font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.qr-item:hover, .qr-item[aria-selected="true"] { background: var(--sel); }
.qr-empty { padding: 10px; color: var(--muted); font-size: 13.5px; }
.qr-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-head); padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.qr-table td.qr-body { max-width: 520px; }
.qr-table td.qr-body span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; color: var(--ink-2); font-size: 14px; }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input > span { display: grid; place-items: center; padding: 0 10px; background: var(--panel-head); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius-m) 0 0 var(--radius-m); color: var(--muted); font-weight: 600; }
.prefix-input .input { border-radius: 0 var(--radius-m) var(--radius-m) 0; flex: 1; min-width: 0; }
.wa-preview { background: var(--wall); border-radius: var(--radius-m); padding: 12px; display: flex; justify-content: flex-end; }
.wa-preview .bubble { background: var(--bubble-out); border-radius: 8px 0 8px 8px; padding: 7px 10px; max-width: 92%; box-shadow: var(--bubble-shadow); font-size: 14.2px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }

.auto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; align-items: start; }
.auto-card { margin-bottom: 0; gap: 16px; }
.auto-head { display: flex; gap: 12px; align-items: flex-start; }
.auto-head h2 { margin: 0 0 2px; font-size: 16.5px; font-weight: 600; }
.auto-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.auto-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-soft-ink); display: grid; place-items: center; flex: none; }
.auto-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.auto-body hr { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }
.auto-toggle b { display: block; font-weight: 600; }
.auto-toggle span { color: var(--muted); font-size: 13.5px; }
.auto-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.week { display: grid; gap: 4px; background: var(--panel-head); border-radius: var(--radius-m); padding: 8px 12px; }
.day-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.day-name { width: 92px; flex: none; align-items: center; }
.day-times { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.day-times .second { display: inline-flex; align-items: center; gap: 6px; }
.day-times .second[hidden] { display: none; }
.input.time { width: 112px; height: 34px; padding: 0 6px; }
.auto-card.wide { grid-column: 1 / -1; }
.auto-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .auto-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .day-row { flex-wrap: wrap; } .day-times { padding-left: 28px; } }
.day-closed { display: none; color: var(--muted); font-size: 13.5px; }
.day-row.closed .day-times { display: none; }
.day-row.closed .day-closed { display: inline; }
.reasons { display: grid; gap: 8px; }
.reasons-title { font-weight: 600; font-size: 14px; }
.reason-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.reason-list li { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: var(--radius-m); background: var(--panel-head); }
.reason-list li.off { opacity: .6; }
.reason-list small { color: var(--muted); }
.reason-add { display: flex; gap: 8px; }
.reason-add .input { flex: 1; min-width: 0; }
.radio-list { display: grid; gap: 8px; }
.radio-list b { font-weight: 600; }
.radio-list span { color: var(--muted); font-size: 13.5px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.check.pick { align-items: center; padding: 6px 8px; border-radius: var(--radius-m); background: var(--panel-head); }

/* ───────────── relatórios ───────────── */
:root { --s1: #2a78d6; --s2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; }
.chart-wrap { display: grid; gap: 8px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s1, .bar.s1 { background: var(--s1); fill: var(--s1); }
.sw.s2, .bar.s2 { background: var(--s2); fill: var(--s2); }
.chart-scroll { overflow-x: auto; }
.chart-inner { position: relative; }
.day-chart { width: 100%; height: auto; display: block; }
.day-chart .grid { stroke: var(--line); stroke-width: 1; }
.day-chart .axis { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.day-chart .hit { fill: transparent; }
.day-chart .hit:hover { fill: color-mix(in srgb, var(--ink) 5%, transparent); }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); border-radius: var(--radius-m);
  padding: 8px 10px; font-size: 12.5px; pointer-events: none; display: grid; gap: 3px; white-space: nowrap; z-index: 5; }
.chart-tip[hidden] { display: none; }
.chart-tip div { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-list li { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 10px; background: var(--panel-head); border-radius: 999px; overflow: hidden; }
.bl-fill { display: block; height: 100%; background: var(--s1); border-radius: 999px; }
.bl-val { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.stars { color: #E7A400; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--line-strong); }
.table-wrap.flat { box-shadow: none; border-radius: 0; }
.rp-table td.tnum { white-space: nowrap; }

/* ───────────── celular ───────────── */
@media (max-width: 900px) {
  .shell, .shell.area-admin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .rail, .area-admin .rail { grid-row: 3; flex-direction: row; justify-content: space-around; align-items: center; padding: 4px 8px; border-right: 0; border-top: 1px solid var(--chrome-line); overflow-x: auto; gap: 2px; background: var(--chrome); }
  .rail-logo, .admin-brand, .admin-nav p, .me-text { display: none; }
  .admin-nav, .admin-switch { display: contents; }
  .area-admin .rail a { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; font-size: 10.5px; min-width: 56px; }
  .area-admin .rail .dot { position: absolute; }
  .rail a { width: auto; min-width: 56px; padding: 6px 4px; }
  .rail-bottom, .area-admin .rail-bottom { margin: 0; display: flex; border: 0; padding: 0; }
  .me-btn .avatar { width: 30px; height: 30px; }
  .main { grid-row: 2; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox.has-open .list-pane { display: none; }
  .inbox:not(.has-open) .chat-pane { display: none; }
  .back { display: inline-grid; color: var(--mobile-head-ink); }
  .back:hover { color: var(--mobile-head-ink); }
  /* cabeçalhos verdes, como no WhatsApp do celular */
  .chat-head { background: var(--mobile-head); color: var(--mobile-head-ink); border-left: 0; gap: 10px; padding: 8px 10px; }
  .chat-head .who span { color: color-mix(in srgb, var(--mobile-head-ink) 75%, transparent); }
  .list-head { padding-top: 0; }
  .list-head-row { background: var(--mobile-head); color: var(--mobile-head-ink); margin: 0 -16px; padding: 10px 16px; }
  .list-head-row .btn { background: transparent; color: var(--mobile-head-ink); border-color: color-mix(in srgb, var(--mobile-head-ink) 50%, transparent); }
  .chat-head .who { min-width: min(150px, 45%); }
  .stamp { padding-right: 3px; }
  .stamp .stamp-name { display: none; }
  .msg { max-width: 88%; }
  .msg-tools { position: static; opacity: 1; justify-self: end; }
  .messages { padding: 12px 14px 8px; }
  .login-card { grid-template-columns: 1fr; padding: 28px 22px; margin-top: 72px; gap: 28px; }
  .login-top { padding-top: 16px; }
  .login-logo { height: 34px; }
  .login-preview { display: none; }
  .two { grid-template-columns: 1fr; }
  .sign-note { padding-left: 16px; }
  .sv-grid { grid-template-columns: minmax(0, 1fr); }
  .bulk-bar { top: -28px; }
  .atd-table th:nth-child(5), .atd-table td:nth-child(5), .atd-table th:nth-child(6), .atd-table td:nth-child(6) { display: none; }
  .btn-label { display: none; }
  .head-tags { padding-left: 0; }
  .ct-table th:nth-child(n+2):nth-child(-n+6), .ct-table td:nth-child(n+2):nth-child(-n+6) { display: none; }
  .ct-table .user-cell .m-only { display: block; }
  .chat-head > .avatar-btn .avatar { width: 38px; height: 38px; }
  .qr-step { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .area-admin .rail a.sub { margin-left: 0; border-left: 0; }
  .popups { top: 66px; }
  .popup-actions { padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.check > input { flex: none; margin-top: 3px; }
.auto-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.reason-list .grow { flex: 1; min-width: 0; }

/* conectar com número de telefone (código) */
.pair-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.pair-box summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.pair-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.pair-form .field { flex: 1; min-width: 220px; }
.pair-code-box { display: grid; gap: 10px; justify-items: start; margin-top: 10px; }
.pair-code { font: 700 30px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 4px; background: var(--panel-head); padding: 12px 18px; border-radius: var(--radius-m); }
.warn-note { background: var(--warn-soft); color: var(--warn); }

/* emojis */
.emoji-pop { position: absolute; left: 16px; bottom: calc(100% + 6px); width: min(380px, calc(100% - 32px)); background: var(--panel); border-radius: var(--radius-l);
  box-shadow: var(--shadow); z-index: 31; display: grid; grid-template-rows: auto 1fr; max-height: 320px; overflow: hidden; }
.emoji-pop[hidden] { display: none; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-tabs button { border: 0; background: transparent; border-radius: 8px; height: 34px; min-width: 38px; font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--muted); }
.emoji-tabs button span { font-size: 12.5px; display: none; }
.emoji-tabs button[aria-selected="true"] { background: var(--sel); color: var(--ink); }
.emoji-tabs button[aria-selected="true"] span { display: inline; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); padding: 6px; overflow-y: auto; }
.emoji { border: 0; background: transparent; font-size: 24px; height: 40px; border-radius: 8px; cursor: pointer; line-height: 1; }
.emoji:hover, .emoji:focus-visible { background: var(--sel); }
/* gravar áudio */
.composer .send.mic[hidden], .composer .send[hidden] { display: none; }
.composer.recording { align-items: center; }
.rec-info { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--input); border-radius: var(--radius-m); height: 42px; padding: 0 14px; min-width: 0; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recblink 1.1s ease-in-out infinite; flex: none; }
@keyframes recblink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-label { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.danger { color: var(--danger); }

/* painel de informações do contato */
.inbox { position: relative; }
.info-pane { display: none; }
.inbox.info-open { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr) 360px; }
.inbox.info-open .info-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.chat-head .who { cursor: pointer; }
.icon-btn.info-toggle.on { color: var(--wa); background: color-mix(in srgb, var(--wa) 12%, transparent); }
.info-head { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 22px 18px 16px; position: relative; border-bottom: 1px solid var(--line); }
.info-head h2 { margin: 6px 0 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.info-head p { margin: 0; }
.info-close { position: absolute; top: 8px; right: 8px; }
.info-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.info-body { display: grid; gap: 12px; padding: 14px 16px 24px; align-content: start; }
.info-notes { display: grid; gap: 6px; }
.info-notes label { font-weight: 600; font-size: 14px; }
.info-notes textarea { resize: vertical; min-height: 90px; }
.info-notes-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.info-sec { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel); }
.info-sec > summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; list-style: none; }
.info-sec > summary::-webkit-details-marker { display: none; }
.info-sec > summary::after { content: '⌄'; margin-left: auto; color: var(--muted); transition: transform .15s; }
.info-sec[open] > summary::after { transform: rotate(180deg); }
.info-sec > summary .count { background: var(--panel-head); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--muted); }
.info-sec > :not(summary) { padding: 0 14px 14px; }
.info-dl { margin: 0; display: grid; gap: 10px; }
.info-row dt { font-size: 12.5px; color: var(--muted); }
.info-row dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.info-row dd small { font-weight: 400; }
.info-hist { list-style: none; margin: 0; display: grid; gap: 8px; }
.info-hist li { border-left: 3px solid var(--line-strong); padding: 4px 0 4px 10px; display: grid; gap: 3px; justify-items: start; }
.info-hist li.current { border-left-color: var(--wa); }
.ih-top { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.ih-meta { font-size: 12.8px; color: var(--ink-2); }
@media (max-width: 1280px) {
  .inbox.info-open { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); }
  .inbox.info-open .info-pane { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 100%); z-index: 25; box-shadow: var(--shadow); }
}
@media (max-width: 900px) {
  .inbox.info-open { grid-template-columns: minmax(0, 1fr); }
  .inbox.info-open .info-pane { width: 100%; }
}
.info-pane > * { flex: none; }

/* ouvir o áudio antes de enviar */
.composer.preview .rec-info { padding: 0 8px 0 4px; }
.composer.preview audio { height: 36px; flex: 1; min-width: 0; max-width: 420px; }
.composer.preview .rec-label { flex: none; }
@media (max-width: 560px) { .composer.preview .rec-label { display: none; } }

/* conversa com outro atendente (visão do supervisor/Master) */
.held-bar { display: flex; align-items: center; gap: 12px; margin: 8px 16px 10px; padding: 12px 14px; border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--wa) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--wa) 25%, var(--line)); }
.held-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--wa) 15%, transparent); color: var(--wa); flex: none; }
.held-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.held-text small { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--wa); }
.held-text span { font-size: 14.5px; color: var(--ink-2); }
.held-text b { color: var(--ink); }
.held-btn { background: var(--wa); border-color: var(--wa); color: var(--wa-ink); border-radius: 999px; white-space: nowrap; }
.held-btn:hover { background: var(--wa-hover); }
.icon.flip { transform: scaleX(-1); }
@media (max-width: 560px) { .held-bar { flex-wrap: wrap; } .held-btn { width: 100%; justify-content: center; } }

/* conta: esqueci minha senha, e-mail de envio */
.forgot-link { background: none; border: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: 14px; justify-self: center; padding: 4px; }
.forgot-link:hover { color: var(--ink); }
.dialog form { display: grid; gap: 12px; }
.pw-box summary { cursor: pointer; font-weight: 600; font-size: 14px; margin-top: 6px; }
.pw-box[open] { display: grid; gap: 10px; }
.mail-box { max-width: 660px; margin-top: 18px; }
.mail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.mail-grid .span2 { grid-column: 1 / -1; }
.mail-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.mail-test { display: flex; gap: 8px; flex: 1; min-width: 260px; justify-content: flex-end; }
.mail-test .input { max-width: 260px; }
@media (max-width: 640px) { .mail-grid { grid-template-columns: minmax(0, 1fr); } .mail-test { justify-content: stretch; } .mail-test .input { max-width: none; } }

/* contato compartilhado */
.vcards { display: grid; gap: 8px; min-width: min(260px, 70vw); }
.vcard { display: grid; gap: 8px; padding: 4px 2px 2px; }
.vcard + .vcard { border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); padding-top: 10px; }
.vcard-top { display: flex; gap: 10px; align-items: center; }
.vcard-who { display: grid; gap: 1px; min-width: 0; }
.vcard-who b { font-size: 15px; }
.vcard-who span { font-size: 14px; }
.vcard-who small { color: var(--muted); font-size: 12.5px; }
.vcard-actions { display: flex; gap: 4px; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); padding-top: 6px; }
.vcard-actions .btn { flex: 1; justify-content: center; color: var(--wa); }

.groups-toggle { font-size: 14px; }
.groups-toggle b { font-weight: 600; }
.groups-toggle span { color: var(--muted); font-size: 13px; }

/* ───────── senha definida pelo Master ───────── */
.pass-row { display: flex; gap: 6px; align-items: center; }
.pass-row .input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.pass-row .btn { flex: none; }
.pass-show { display: grid; gap: 12px; max-width: 420px; }
.pass-box { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 14px; border-radius: 10px;
  background: var(--hover); border: 1px solid var(--line); }
.pass-box code { font-size: 22px; letter-spacing: 2px; font-weight: 700; user-select: all; }

/* ───────── início e fim de cada atendimento na conversa ───────── */
.event.divider { position: relative; font-weight: 600; }
.event.divider::before, .event.divider::after { content: ''; position: absolute; top: 50%; width: 40px; border-top: 1px dashed var(--line-strong, #c9d1d6); }
.event.divider::before { right: calc(100% + 8px); }
.event.divider::after { left: calc(100% + 8px); }
.ih-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.msg.flash .bubble, .event.flash { box-shadow: 0 0 0 2px #f5b301; transition: box-shadow .3s; }

/* ───────── mesmo cliente em vários departamentos ───────── */
.dept-bar { flex-basis: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2);
  background: var(--hover); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.dept-bar .icon { flex: none; }
.dept-toggle { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-weight: 600; color: var(--ink); cursor: pointer; }
.dept-tag { display: flex; width: max-content; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--dep); margin-bottom: 2px;
  text-transform: uppercase; letter-spacing: .3px; }
.msg.other-dept .bubble { opacity: .93; outline: 1px dashed color-mix(in srgb, var(--ink-2) 35%, transparent); outline-offset: -1px; }

/* ───────── página de etiquetas ───────── */
.tag-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tag-search { position: relative; flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; }
.tag-search .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.tag-search .input { padding-left: 34px; width: 100%; }
.tag-tools select.input { width: auto; }
.tag-bulk { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: var(--hover); border: 1px solid var(--line); }
.tag-bulk[hidden] { display: none; }
th.sel, td.sel { width: 36px; }
.btn.ghost.danger { color: var(--danger, #D2363F); }
.tag-menu-search { margin: 0 0 6px; height: 34px; }
.tag-menu-list { max-height: 300px; overflow-y: auto; }

.pick-role { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--hover); color: var(--muted); border: 1px solid var(--line); }

/* ═════════ Página inicial (login) ═════════ */
.landing { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr); background: var(--panel); }
.lp-hero { position: relative; overflow: hidden; color: #fff; background: #0B0D0C; padding: 32px clamp(24px, 4vw, 64px) 24px;
  display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 28px; min-height: 100vh; isolation: isolate; }
.lp-hero::before { content: ''; position: absolute; inset: -20% -10% auto auto; width: 720px; height: 720px; z-index: -1;
  background: radial-gradient(circle, rgba(0, 168, 132, .28), transparent 62%); filter: blur(10px); }
.lp-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.lp-logo { height: 40px; width: auto; display: block; }
.lp-copy { max-width: 620px; }
.lp-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  color: #9FE7D3; background: rgba(0, 168, 132, .12); border: 1px solid rgba(0, 168, 132, .35); padding: 6px 12px; border-radius: 999px; }
.lp-dot { width: 7px; height: 7px; border-radius: 50%; background: #25D366; box-shadow: 0 0 0 0 rgba(37, 211, 102, .6); animation: lp-pulse 2s infinite; }
.lp-copy h1 { margin: 18px 0 14px; font-size: clamp(30px, 3.4vw, 48px); line-height: 1.08; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.lp-copy h1 em { font-style: normal; background: linear-gradient(90deg, #25D366, #7CF0C9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-copy p { margin: 0; font-size: 16.5px; line-height: 1.55; color: #B8C2C0; max-width: 54ch; }

.lp-stage { position: relative; align-self: center; max-width: 720px; width: 100%; padding: 18px 36px 26px 0; }
.lp-window { background: #fff; color: var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  transform: perspective(1400px) rotateY(-4deg) rotateX(2deg); transform-origin: left center; }
.lp-bar { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: #F0F2F5; border-bottom: 1px solid #E3E6E8; }
.lp-bar i { width: 10px; height: 10px; border-radius: 50%; background: #D7DBDE; }
.lp-bar i:nth-child(1) { background: #FF5F57; } .lp-bar i:nth-child(2) { background: #FEBC2E; } .lp-bar i:nth-child(3) { background: #28C840; }
.lp-bar span { margin-left: 10px; font-size: 11.5px; color: #667781; font-weight: 600; }
.lp-app { display: grid; grid-template-columns: 220px 1fr; height: 330px; }
.lp-list { border-right: 1px solid #E9EDEF; overflow: hidden; }
.lp-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; padding: 9px 10px; border-bottom: 1px solid #F0F2F5; font-size: 12px; }
.lp-row.on { background: #F0F2F5; }
.lp-row b { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 600; color: #111B21; white-space: nowrap; }
.lp-row b small { font-weight: 400; color: #8696A0; font-size: 10.5px; }
.lp-row div > span { display: block; color: #667781; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-row em { font-style: normal; background: #25D366; color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.lp-tag { display: inline-block; margin-top: 3px; font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; padding: 1px 6px; border-radius: 4px;
  color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, #fff); }
.lp-av { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.lp-chat { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.lp-chat-head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: #F0F2F5; border-bottom: 1px solid #E3E6E8; }
.lp-chat-head b { display: block; font-size: 13px; } .lp-chat-head span { font-size: 11px; color: #667781; }
.lp-chat-head .lp-av { width: 30px; height: 30px; font-size: 11px; }
.lp-msgs { background-color: #EFEAE2; background-image: radial-gradient(rgba(84,101,111,.08) 1.2px, transparent 1.6px); background-size: 14px 14px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.lp-msg { max-width: 78%; padding: 6px 9px 5px; border-radius: 8px; font-size: 12.5px; line-height: 1.35; box-shadow: 0 1px .5px rgba(11,20,26,.13);
  display: flex; flex-direction: column; animation: lp-in 12s var(--d) infinite both; }
.lp-msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.lp-msg.out { align-self: flex-end; background: #D9FDD3; border-top-right-radius: 2px; }
.lp-msg small { align-self: flex-end; font-size: 10px; color: #667781; margin-top: 2px; display: inline-flex; gap: 3px; align-items: center; }
.lp-tick { color: #53BDEB; display: inline-flex; }
.lp-author { font-size: 11.5px; color: #008069; }
.lp-msg.deleted { background: #FDEDEF; outline: 1px solid #F3B6C0; }
.lp-del { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; color: #C0234E; font-style: italic; }
.lp-event { align-self: center; font-size: 10.5px; color: #54656F; background: #FFF3C4; padding: 3px 9px; border-radius: 6px; display: inline-flex; gap: 5px; align-items: center;
  animation: lp-in 12s var(--d) infinite both; }
.lp-typing { align-self: flex-end; background: #D9FDD3; padding: 8px 10px; border-radius: 8px; display: flex; gap: 3px; animation: lp-in 12s var(--d) infinite both; }
.lp-typing i { width: 5px; height: 5px; border-radius: 50%; background: #6b8f7a; animation: lp-blink 1s infinite; }
.lp-typing i:nth-child(2) { animation-delay: .15s; } .lp-typing i:nth-child(3) { animation-delay: .3s; }

.lp-float { position: absolute; display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.97); color: var(--ink); border-radius: 12px;
  padding: 10px 14px 10px 10px; box-shadow: 0 16px 40px rgba(0,0,0,.4); font-size: 12px; animation: lp-float 6s ease-in-out infinite; }
.lp-float b { display: block; font-size: 12.5px; } .lp-float span { color: #667781; }
.lp-float-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #E7F0FE; color: #2F6FD6; }
.lp-float-ic.ok { background: #DCF8E9; color: #0E8A55; } .lp-float-ic.star { background: #FFF2CC; color: #C98A00; }
.lp-float.f1 { right: 0; top: 34%; animation-delay: -1s; }
.lp-float.f2 { right: 6%; bottom: -6px; animation-delay: -3s; }
.lp-float.f3 { left: -14px; top: -8px; animation-delay: -2s; }

.lp-feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.lp-feats li { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.lp-feats b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.lp-feats span { font-size: 12.5px; color: #A9B4B2; line-height: 1.4; }
.feat-ic { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(0,168,132,.16); color: #5EE0B8; }
.lp-foot { font-size: 12px; color: #6F7C79; }

.lp-side { display: grid; place-items: center; padding: 40px clamp(20px, 4vw, 56px); background: var(--panel); }
.lp-form { width: 100%; max-width: 400px; display: grid; gap: 16px; }
.lp-form-logo { height: 34px; width: auto; justify-self: start; margin-bottom: 18px; }
.lp-hello { font-size: 14px; font-weight: 600; color: var(--green); }
.lp-form h2 { margin: -8px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.lp-sub { margin: -6px 0 6px; color: var(--muted); font-size: 14.5px; }
.lp-input { position: relative; display: flex; align-items: center; }
.lp-input > .icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.lp-input .input { height: 48px; padding-left: 40px; border-radius: 10px; font-size: 15px; width: 100%; }
.lp-input .input:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.pass-eye { position: absolute; right: 6px; width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pass-eye:hover, .pass-eye.on { color: var(--ink); background: var(--hover); }
.lp-input:has(.pass-eye) .input { padding-right: 46px; }
.lp-row2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; font-size: 13.5px; }
.lp-remember { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); cursor: pointer; }
.lp-row2 .forgot-link { margin: 0; }
.lp-submit { height: 50px; border-radius: 10px; font-size: 15.5px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.lp-submit .icon { transform: rotate(180deg); transition: transform .2s; }
.lp-submit:hover .icon { transform: rotate(180deg) translateX(-3px); }
.lp-safe { display: flex; gap: 6px; align-items: center; justify-content: center; margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

@keyframes lp-in { 0% { opacity: 0; transform: translateY(8px) scale(.98); } 4%, 88% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; transform: none; } }
@keyframes lp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes lp-blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@keyframes lp-pulse { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,.6); } 70% { box-shadow: 0 0 0 8px rgba(37,211,102,0); } 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); } }
@media (prefers-reduced-motion: reduce) {
  .lp-msg, .lp-event, .lp-typing, .lp-float, .lp-dot { animation: none !important; opacity: 1; }
}
@media (max-width: 1180px) {
  .lp-feats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-app { grid-template-columns: 180px 1fr; }
}
@media (max-width: 920px) {
  .landing { grid-template-columns: 1fr; }
  .lp-hero { min-height: 0; grid-template-rows: auto; padding-bottom: 28px; gap: 18px; }
  .lp-stage, .lp-feats, .lp-foot { display: none; }
  .lp-copy h1 { font-size: 28px; margin-top: 12px; }
  .lp-copy p { font-size: 15px; }
  .lp-side { padding: 28px 16px 40px; place-items: start center; }
  .lp-form-logo { display: none; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lp-form-logo { filter: invert(1); } }
:root[data-theme="dark"] .lp-form-logo { filter: invert(1); }
/* ajustes da página inicial */
.lp-chat-head .lp-av { color: #fff; }
.lp-app { height: 330px; }
.lp-msgs { gap: 5px; padding: 10px 12px; }
.lp-float.f1 { right: -6px; top: 44%; }
.lp-feats li { align-items: center; padding: 12px; }
.lp-feats li div > span { display: none; }
.lp-feats b { margin: 0; font-size: 13px; line-height: 1.3; }
@media (min-width: 1500px) { .lp-feats li { align-items: flex-start; } .lp-feats li div > span { display: block; } }
.lp-side { position: sticky; top: 0; align-self: start; min-height: 100vh; }
@media (max-width: 1180px) { .lp-feats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 920px) { .lp-side { position: static; min-height: 0; } }
.lp-float.f1 { top: 19%; }
