/* ---------- tema ---------- */
:root, [data-theme="dark"] {
  --bg: #0b0c0f; --sidebar: #16181d; --surface: #111317; --surface-2: #1b1e24; --hover: #20242b;
  --border: #262a31; --text: #eef0f3; --muted: #8b93a0; --primary: #2f80ed; --primary-text: #fff;
  --azul: #3b82f6; --amarelo: #eab308; --roxo: #8b5cf6; --verde: #22c55e; --vermelho: #ef4444; --laranja: #f59e0b;
  --wa-in: #1b1e24; --wa-out: #144d37; --chat-bg: #0d0f12; --danger: #ef4444; --ok: #22c55e;
  --chip-bg: #e9ecf1; --chip-text: #111317; --shadow: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f4f7; --sidebar: #ffffff; --surface: #ffffff; --surface-2: #f3f4f7; --hover: #eef0f4;
  --border: #e3e6eb; --text: #151a22; --muted: #6b7380; --primary: #1d6fe0;
  --wa-in: #ffffff; --wa-out: #d9fdd3; --chat-bg: #efeae2; --chip-bg: #1f2937; --chip-text: #fff;
  --shadow: 0 10px 30px rgba(15,23,42,.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0 0 12px; letter-spacing: -.2px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
input, select, textarea { font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 5px; font-size: 14px; color: var(--text); }
.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.sucesso { background: var(--verde); border-color: var(--verde); color: #04140a; }
.btn.danger { color: var(--danger); }
.btn.link { border: 0; background: none; color: var(--primary); padding: 4px 8px; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.bloco { width: 100%; justify-content: center; padding: 10px; }
.icone-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text); cursor: pointer; position: relative; text-decoration: none; }
.icone-btn:hover { background: var(--hover); }
.icone-btn.borda { border: 1px solid var(--border); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.erro { color: var(--danger); min-height: 1em; }
.badge { background: var(--vermelho); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 18px; min-width: 18px; text-align: center; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.logo-grande { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.logo-grande-texto b, .logo-texto b { color: var(--primary); font-weight: 700; }
.logo-icone { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 900; font-size: 18px; flex: none; overflow: hidden; }
.logo-icone.com-imagem { background: transparent; }
.logo-icone img { width: 100%; height: 100%; object-fit: contain; }
.logo-icone.grande { width: 72px; height: 72px; border-radius: 18px; font-size: 34px; }

/* ---------- layout ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 264px; flex: none; background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: width .15s; }
.sidebar-topo { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 17px; font-weight: 800; }
.menu { flex: 1; overflow-y: auto; padding: 6px 10px; }
.grupo { margin-bottom: 10px; }
.grupo-titulo { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted);
  padding: 9px 12px; margin-bottom: 4px; border-radius: 10px; background: var(--surface-2); position: relative; }
.grupo-titulo::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--cor); }
.menu a, .menu-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 10px; color: var(--text);
  text-decoration: none; font-size: 15px; position: relative; border: 0; background: none; width: 100%; cursor: pointer; font-family: inherit; }
.menu a:hover, .menu-item:hover { background: var(--hover); }
.menu a.ativo { background: var(--hover); font-weight: 600; }
.menu a.ativo::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--cor); }
.menu a .badge { margin-left: auto; }
.sidebar-rodape { border-top: 1px solid var(--border); padding: 10px; }
.usuario { display: flex; align-items: center; gap: 10px; padding: 8px 6px 2px; }
.usuario-info { flex: 1; min-width: 0; display: grid; }
.usuario-info b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-info small { color: var(--muted); text-transform: capitalize; }
[data-theme="dark"] .icone-lua, [data-theme="light"] .icone-sol { display: none; }

.layout.recolhido .sidebar { width: 72px; }
.layout.recolhido .logo-texto, .layout.recolhido .menu a span, .layout.recolhido .grupo-titulo, .layout.recolhido .menu-item span,
.layout.recolhido .usuario-info, .layout.recolhido #btn-sair, .layout.recolhido .menu a .badge { display: none; }
.layout.recolhido .sidebar-topo { flex-direction: column; gap: 8px; padding: 14px 0; }
.layout.recolhido .menu a, .layout.recolhido .menu-item { justify-content: center; padding: 11px 0; }
.layout.recolhido .usuario { justify-content: center; }

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.busca-global { position: relative; display: flex; align-items: center; gap: 8px; width: min(560px, 100%);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.busca-global input { border: 0; background: transparent; padding: 10px 0; }
.busca-global kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.resultados { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); z-index: 30; max-height: 60vh; overflow-y: auto; padding: 6px; }
.resultados .rotulo { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; font-weight: 700; }
.resultados a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.resultados a:hover { background: var(--hover); }
.espaco { flex: 1; }
.status-wa { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 10px; }
.status-wa:hover { background: var(--hover); }
.status-wa i { width: 9px; height: 9px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.status-wa.fora i { background: var(--vermelho); box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.status-wa.fora { color: var(--vermelho); }
.sino .badge { position: absolute; top: 0; right: -2px; }
main { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }
main.sem-padding { padding: 0; overflow: hidden; }

/* ---------- avatar ---------- */
.avatar { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
  background: var(--av, #475569); color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.avatar.pequeno { width: 36px; height: 36px; font-size: 13px; }
#topo-avatar { width: 38px; height: 38px; background: var(--chip-bg); color: var(--chip-text); font-size: 13px; }
.avatar .badge { position: absolute; top: -3px; right: -3px; border: 2px solid var(--surface); }
.avatar .canal { position: absolute; bottom: -2px; right: -2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface);
  background: var(--verde); display: grid; place-items: center; }
.avatar .canal svg { width: 9px; height: 9px; stroke: #fff; stroke-width: 3; }

/* ---------- etiquetas ---------- */
.tag { display: inline-flex; align-items: center; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); color: var(--muted); }
.tag.cheia { background: var(--chip-bg); color: var(--chip-text); border-color: var(--chip-bg); }
.tag.n1 { color: var(--azul); border-color: color-mix(in srgb, var(--azul) 60%, transparent); }
.tag.n2 { color: var(--roxo); border-color: color-mix(in srgb, var(--roxo) 60%, transparent); }
.st-aberta, .st-processando { color: var(--azul); }
.st-em_andamento, .st-aguardando_peca, .st-pendente { color: var(--laranja); }
.st-concluida, .st-entregue, .st-autorizada, .st-resolvida { color: var(--verde); }
.st-cancelada, .st-erro { color: var(--vermelho); }

/* ---------- atendimento ---------- */
.inbox { display: grid; grid-template-columns: 450px 1fr; height: 100%; }
.inbox-lista { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.inbox-cabecalho { padding: 16px 14px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--border); }
.inbox-titulo { display: flex; align-items: center; gap: 8px; }
.inbox-titulo h2 { margin: 0; font-size: 17px; flex: 1; }
.segmentado { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.segmentado button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 7px 8px; border-radius: 9px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative; white-space: nowrap; }
.segmentado button.ativo { background: var(--chip-bg); color: var(--chip-text); }
[data-theme="dark"] .segmentado.claro button.ativo { background: #fff; color: #111; }
.segmentado .cont { position: absolute; top: -7px; right: -2px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; font-size: 10px; padding: 0 5px; line-height: 16px; min-width: 18px; }
.abas-status button.ativo { background: var(--hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.abas-status button[data-s="aberta"] svg { color: var(--verde); }
.abas-status button[data-s="pendente"] svg { color: var(--laranja); }
.linha-busca { display: flex; gap: 6px; }
.linha-busca .campo { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 10px; color: var(--muted); }
.linha-busca .campo input { border: 0; background: transparent; padding: 8px 0; }
.icone-btn.conexoes { width: auto; padding: 0 10px; gap: 4px; display: inline-flex; border: 1px solid color-mix(in srgb, var(--verde) 55%, transparent); color: var(--verde); font-weight: 700; }
.icone-btn.conexoes.fora { border-color: color-mix(in srgb, var(--vermelho) 55%, transparent); color: var(--vermelho); }

.conversas { overflow-y: auto; flex: 1; }
.ticket { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 14px 14px 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border); position: relative; }
.ticket::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--acento, transparent); }
.ticket:hover { background: var(--hover); }
.ticket.ativo { background: var(--hover); }
.ticket .avatar { grid-row: span 3; align-self: start; }
.ticket .nome { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .previa { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 2 / 4; }
.ticket .meta-dir { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ticket .meta-dir .tempo.alerta { color: var(--laranja); font-weight: 600; }
.ticket .etiquetas { grid-column: 2 / 4; display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.ticket.nao-lida .nome { color: var(--text); }
.ticket.nao-lida .previa { color: var(--text); font-weight: 500; }

.chat { display: flex; flex-direction: column; min-height: 0; background: var(--chat-bg); }
.chat-topo { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); }
.chat-topo .info { flex: 1; min-width: 160px; display: grid; gap: 2px; }
.chat-topo .info b { font-size: 15px; }
.chat-topo .info .etiquetas { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.mensagens { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 68%; padding: 7px 10px 5px; border-radius: 10px; background: var(--wa-in); word-wrap: break-word; align-self: flex-start;
  box-shadow: 0 1px 1px rgba(0,0,0,.15); }
.msg.saida { align-self: flex-end; background: var(--wa-out); }
.msg .texto { white-space: pre-wrap; }
.msg .meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.msg.falhou { outline: 1px solid var(--danger); }
.msg.com-midia { padding: 4px 4px 4px; }
.msg.com-midia .texto, .msg.com-midia .meta { padding: 0 6px; }
.msg.com-midia .texto { margin-top: 4px; }
.midia-img img { display: block; max-width: min(320px, 100%); max-height: 360px; border-radius: 8px; cursor: zoom-in; }
.msg video { display: block; max-width: min(340px, 100%); max-height: 360px; border-radius: 8px; background: #000; }
.msg audio { display: block; width: 280px; max-width: 100%; height: 40px; margin: 2px; }
.msg .figurinha { width: 140px; height: 140px; object-fit: contain; display: block; }
.msg.midia-sticker { background: transparent; box-shadow: none; }
.documento { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; background: rgba(0,0,0,.18); color: var(--text); text-decoration: none; min-width: 220px; }
.documento svg { width: 30px; height: 30px; color: var(--primary); }
.documento span { display: grid; min-width: 0; }
.documento b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.documento small { color: var(--muted); }
.msg .indisponivel { display: none; padding: 8px 6px; color: var(--muted); font-style: italic; }
.msg.midia-indisponivel .indisponivel { display: block; }
.msg.midia-indisponivel img, .msg.midia-indisponivel video, .msg.midia-indisponivel audio, .msg.midia-indisponivel .midia-img { display: none; }
.chat.arrastando { outline: 2px dashed var(--primary); outline-offset: -8px; }
.chat-envio .anexo { height: 44px; width: 44px; cursor: pointer; flex: none; }
.dia { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 3px 10px; border-radius: 8px; margin: 8px 0; }
.chat-envio { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); align-items: flex-end; }
.chat-envio textarea { min-height: 44px; max-height: 160px; border-radius: 12px; }
.chat-envio .btn { height: 44px; }
.faixa-aceitar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.aviso { padding: 8px 14px; background: rgba(245,158,11,.15); color: var(--laranja); font-size: 13px; }
.vazio { display: grid; place-items: center; align-content: center; gap: 6px; height: 100%; color: var(--muted); padding: 24px; text-align: center; }
.vazio svg { width: 72px; height: 72px; stroke-width: 1.4; opacity: .5; margin-bottom: 8px; }
.vazio h3 { margin: 0; font-size: 20px; color: var(--muted); font-weight: 600; }
.lista-vazia { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- páginas ---------- */
.pagina-topo { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.pagina-topo h2 { margin: 0; flex: 1; min-width: 160px; }
.barra { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.barra input, .barra select { width: auto; flex: 1; min-width: 160px; }
.barra h2 { margin: 0; flex: 1; }
.tabela-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }

.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 12px; }
.grade-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.itens-tabela { border: 0; background: none; }
.itens-tabela td, .itens-tabela th { padding: 4px; border: 0; }
.itens-tabela tbody tr:hover { background: none; }
.itens-tabela input, .itens-tabela select { padding: 7px; }
.totais { text-align: right; font-size: 15px; margin: 10px 0; }
.acoes { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }

dialog { border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.55); }
#modal-corpo { padding: 22px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #24282f; color: #fff; border: 1px solid #333a44;
  padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.erro { background: var(--danger); border-color: var(--danger); }

.alerta-wa { color: var(--danger) !important; font-weight: 600; }
.conexao-wa { border-top: 1px solid var(--border); padding: 12px 0; }
.conexao-wa .barra { flex-wrap: nowrap; }
.qr { display: block; margin: 10px auto; width: 240px; height: 240px; background: #fff; padding: 8px; border-radius: 10px; }
.copiar { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--border); }
p.aviso { border-radius: 10px; }

/* ---------- configurações ---------- */
.config-layout { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.config-abas { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; position: sticky; top: 0; }
.config-abas a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
.config-abas a:hover { background: var(--hover); }
.config-abas a.ativo { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); font-weight: 600; }
.config-conteudo { min-width: 0; max-width: 900px; }
.com-avatar { display: flex; align-items: center; gap: 10px; }
.com-avatar .avatar { width: 32px; height: 32px; font-size: 12px; }
.cores { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cor { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--border); }
.cor.ativa { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }
.cor-livre { margin: 0; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1px var(--border); cursor: pointer;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.cor-livre input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.logo-edicao { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-edicao .btn { cursor: pointer; }

/* ---------- celular ---------- */
.so-celular { display: none !important; }
.fundo-menu { display: none; }
@media (max-width: 900px) {
  .so-celular { display: inline-grid !important; }
  .sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s; width: 270px !important; }
  .layout.menu-aberto .sidebar { transform: none; }
  .layout.menu-aberto .fundo-menu { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  #btn-recolher, .busca-global kbd, .status-wa span { display: none; }
  .topbar { padding: 0 10px; gap: 6px; }
  main { padding: 12px; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.com-conversa .inbox-lista { display: none; }
  .inbox:not(.com-conversa) .chat { display: none; }
  .msg { max-width: 86%; }
  .mensagens { padding: 12px; }
  .copiar { grid-template-columns: 1fr auto; }
  .config-layout { grid-template-columns: 1fr; }
  .config-abas { grid-auto-flow: column; overflow-x: auto; position: static; }
  .config-abas a { white-space: nowrap; }
  .copiar > .muted { grid-column: 1 / -1; }
}

/* ---------- impressão da OS ---------- */
@media print {
  body:has(#modal[open] #impressao) > *:not(#modal) { display: none !important; }
  body { background: #fff !important; }
  #modal[open]:has(#impressao) { position: static; inset: auto; margin: 0; width: 100%; max-width: none; max-height: none; overflow: visible; box-shadow: none; border: 0; background: #fff; }
  #modal::backdrop { background: none; }
  #impressao, #impressao * { color: #000 !important; }
  #impressao input, #impressao select, #impressao textarea { background: #fff !important; border-color: #bbb !important; }
  .nao-imprimir { display: none !important; }
  .so-imprimir { display: flex !important; }
}
.so-imprimir { display: none; }
.cabecalho-empresa { align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #999; font-size: 12px; line-height: 1.4; }
.cabecalho-empresa img { max-height: 64px; max-width: 160px; object-fit: contain; }
.ponto-empresa { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.logo-empresa { display: inline-flex; align-items: center; justify-content: center; min-width: 120px; height: 64px; padding: 4px 8px; border: 1px dashed var(--border); border-radius: 8px; background: #fff; }
.logo-empresa img { max-height: 56px; max-width: 160px; object-fit: contain; }

/* produtos e estoque */
.dir { text-align: right; }
.badge.alerta { background: var(--amarelo); color: #1a1a1a; }
.cards-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card-resumo { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.card-resumo small { color: var(--muted); }
.card-resumo b { font-size: 20px; }
.card-resumo.aviso b { color: var(--amarelo); }
.card-resumo.perigo b { color: var(--vermelho); }
.estoque { font-weight: 600; }
.estoque.ok { color: var(--verde); }
.estoque.baixo { color: var(--amarelo); }
.estoque.zerado { color: var(--vermelho); }
.estoque-caixa { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px; border-radius: 10px; background: var(--surface-2); margin: 10px 0; }
.estoque-caixa > div { display: flex; flex-direction: column; }
.estoque-caixa b { font-size: 20px; }
.tabela-wrap.mov { max-height: 240px; overflow: auto; }
.positivo { color: var(--verde); }
.negativo { color: var(--vermelho); }
.itens-tabela .dica { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.itens-tabela .dica.baixo { color: var(--amarelo); }
.itens-tabela .dica.zerado { color: var(--vermelho); }
@media print { .itens-tabela .dica { display: none; } }
.itens-tabela select[data-k=tipo] { min-width: 132px; }

/* financeiro */
.mes-nav { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 3px 4px; }
.mes-nav b { min-width: 130px; text-align: center; }
.mes-nav .icone-btn { font-size: 20px; line-height: 1; }
.fin-barra .segmentado { min-width: 260px; }
.aviso-txt { color: var(--amarelo); }
.abas-linha { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.abas-linha button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 9px 14px; cursor: pointer; margin-bottom: -1px; }
.abas-linha button.ativo { color: var(--text); border-bottom-color: var(--primary); }
.alerta-atraso { border-color: var(--vermelho); margin-bottom: 14px; }
.alerta-atraso > b { color: var(--vermelho); display: block; margin-bottom: 8px; }
.barra-cat { margin: 10px 0; }
.barra-cat-topo { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.trilho { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.trilho i { display: block; height: 100%; border-radius: 4px; }
i.receita { background: var(--verde); }
i.despesa { background: var(--vermelho); }
.grafico-ano { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 180px; align-items: end; }
.mes-col { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; }
.mes-col .colunas { flex: 1; width: 100%; display: flex; gap: 2px; align-items: flex-end; justify-content: center; }
.mes-col .colunas i { width: 40%; max-width: 18px; min-height: 1px; border-radius: 3px 3px 0 0; }
.mes-col small { color: var(--muted); }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; }
.pagamento-os { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin: 10px 0; }
.pagamento-os > div:first-child { display: flex; flex-direction: column; }
.pagamentos-lista { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; flex-direction: row; }
label.check input { width: auto; }

/* computadores (Breeze) */
.sev { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sev.vermelho { background: color-mix(in srgb, var(--vermelho) 18%, transparent); color: var(--vermelho); }
.sev.laranja { background: color-mix(in srgb, var(--laranja) 18%, transparent); color: var(--laranja); }
.sev.amarelo { background: color-mix(in srgb, var(--amarelo) 18%, transparent); color: var(--amarelo); }
.sev.azul { background: color-mix(in srgb, var(--azul) 18%, transparent); color: var(--azul); }
.sev.cinza { background: var(--surface-2); color: var(--muted); }
.orgs-breeze { display: flex; flex-direction: column; gap: 8px; }
.org-breeze { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.org-topo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.org-nome { background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 4px 0; display: flex; align-items: center; gap: 6px; }
.org-nome .seta { display: inline-block; transition: transform .15s; color: var(--muted); font-size: 18px; }
.org-breeze.aberta .seta { transform: rotate(90deg); }
.org-breeze.aberta .tabela-wrap { margin-top: 8px; }
label.vinculo { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
label.vinculo select { width: auto; min-width: 180px; padding: 6px 8px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; margin-bottom: 12px; }

/* respostas rápidas e atendimento */
.campo-envio { position: relative; flex: 1; display: flex; }
.campo-envio textarea { flex: 1; }
.sugestoes-resposta { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; z-index: 20; padding: 4px; }
.sugestoes-resposta button { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sugestoes-resposta button span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugestoes-resposta button.sel, .sugestoes-resposta button:hover { background: var(--hover); }
.sugestoes-resposta .muted { padding: 8px 10px; }
td.pre { white-space: pre-wrap; }
.dias-horario { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px 16px; margin-bottom: 12px; }
.dias-horario .dia { display: flex; align-items: center; gap: 8px; }
.dias-horario .dia label.check { min-width: 92px; margin: 0; }
.dias-horario input[type=time] { width: auto; flex: 1; min-width: 0; padding: 6px; }
.aviso-os { margin-bottom: 10px; }
.aviso-os textarea { margin-top: 4px; }
.linha-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .linha-form label.check { margin: 0; }
.f-empresa input[type=color] { height: 42px; padding: 4px 6px; cursor: pointer; }

/* gravação de áudio */
.chat-envio { position: relative; }
.gravando { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--surface); border-radius: 12px; z-index: 2; }
.ponto-rec { width: 12px; height: 12px; border-radius: 50%; background: var(--vermelho); animation: piscar 1s infinite; }
.tempo-rec { font-variant-numeric: tabular-nums; min-width: 42px; }
@keyframes piscar { 50% { opacity: .25; } }

/* foto de perfil e grupos */
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.msg .autor { font-size: 12px; font-weight: 700; margin-bottom: 2px; filter: brightness(1.35); }
.abas-status { grid-template-columns: repeat(4, 1fr); }
.abas-status button { padding-left: 4px; padding-right: 4px; }
.cont.nao-lidas { background: var(--verde); color: #fff; }

/* entrada do equipamento na OS */
.checks.acessorios { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 10px; }
.checks.acessorios input:not([type]) { flex: 1 1 180px; min-width: 160px; }
.fotos-os { margin: 10px 0; }
.miniaturas { display: flex; flex-wrap: wrap; gap: 8px; }
.miniaturas .mini { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.miniaturas .mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.miniaturas .mini button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 12px; }
.miniaturas .mini.nova { outline: 2px dashed var(--amarelo); outline-offset: -2px; }
.termo-os { margin-top: 14px; }
.termo-texto { font-size: 12px; color: var(--muted); line-height: 1.45; }
.termo-texto p { margin: 0 0 4px; }
.quadro-assinatura { display: block; width: 100%; max-width: 700px; aspect-ratio: 7 / 2; background: #fff; border: 1px dashed #999; border-radius: 8px; touch-action: none; cursor: crosshair; margin-bottom: 8px; }
.assinado img { display: block; max-width: 320px; max-height: 100px; background: #fff; border-radius: 6px; }
.linha-assinatura { border-top: 1px solid currentColor; max-width: 360px; margin-top: 36px; padding-top: 4px; font-size: 12px; }
.assinado .linha-assinatura { margin-top: 0; }
.so-imprimir-inline { display: none; }
@media print {
  .so-imprimir-inline { display: inline; }
  .termo-texto { color: #000 !important; }
  .miniaturas .mini { width: 80px; height: 80px; }
  .fotos-os:has(.miniaturas > .muted) { display: none; }
}

tr.inativo td { opacity: .55; }
.barra label.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }

/* painel inicial */
.painel-card { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.painel-card:hover { border-color: var(--accent, #2f80ed); transform: translateY(-1px); }
.card-resumo.ok b { color: var(--verde); }
.painel-blocos { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.painel-blocos .card { margin: 0; }
.lista-painel { list-style: none; margin: 0; padding: 0; }
.lista-painel li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.lista-painel li:first-child { border-top: 0; }
.lista-painel li[data-os] { cursor: pointer; }
.lista-painel li[data-os]:hover { color: var(--accent, #2f80ed); }
@media (max-width: 600px) { .painel-blocos { grid-template-columns: 1fr; } }
.lista-painel .data, .lista-painel .valor, .lista-painel .tag { white-space: nowrap; flex: none; }
.lista-painel .desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-resumo.duplo b { display: flex; flex-direction: column; font-size: 17px; line-height: 1.3; }

/* boleto */
.f-cora { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.copiavel { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.copiavel code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.btn.boleto { border-color: var(--azul, #2f80ed); color: var(--azul, #2f80ed); }
.btn.boleto.pago { border-color: var(--verde); color: var(--verde); }
.acoes-linha { white-space: nowrap; }
.acoes-linha .btn + .btn { margin-left: 6px; }
