:root {
  --bg: #12141f;
  --bg2: #1b1e2e;
  --panel: #232740;
  --line: #34395a;
  --ink: #eef0f7;
  --ink2: #a9aecb;
  --ink3: #6f7499;
  --pix: 'Press Start 2P', ui-monospace, monospace;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --green: #3ddc84;
  --amber: #ffb547;
  --red: #ff5a5f;
  --blue: #4f8cff;
  --paper: #f6f3ec;
  --paper2: #ece7db;
  --text: #24232a;
  --text2: #6b6875;
  --bubble-out: #d9fdd3;
  --radius: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--ui); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.pix { font-family: var(--pix); letter-spacing: .02em; }
.hidden { display: none !important; }

/* ---------- botões estilo pixel ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 2px solid #0b0c14; background: var(--panel); color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius); box-shadow: 0 3px 0 #0b0c14; font-weight: 600; white-space: nowrap;
  transition: transform .05s, box-shadow .05s, background .15s;
}
.btn:hover { background: #2d3253; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b0c14; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: #3f7af0; }
.btn.go { background: var(--green); color: #0b2a17; }
.btn.go:hover { background: #2fcf77; }
.btn.stop { background: var(--amber); color: #3a2400; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.light .btn { background: #fff; color: var(--text); border-color: #22212a; box-shadow: 0 3px 0 #22212a; }
.light .btn:hover { background: #f1eee6; }
.light .btn.primary { background: var(--blue); color: #fff; }
.light .btn.go { background: var(--green); color: #0b2a17; }
.light .btn.danger { background: var(--red); color: #fff; }
.light .btn.ghost { background: transparent; box-shadow: none; border-color: #cfc9bb; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 120%, #2a2f55 0%, var(--bg) 60%); }
.login-card { width: min(380px, 100%); background: var(--bg2); border: 2px solid #0b0c14; box-shadow: 0 6px 0 #0b0c14; border-radius: 6px; padding: 28px; }
.login-card h1 { font-family: var(--pix); font-size: 16px; line-height: 1.6; margin: 18px 0 6px; text-align: center; }
.login-card p { color: var(--ink2); text-align: center; margin: 0 0 22px; }
.login-building { display: block; margin: 0 auto; image-rendering: pixelated; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.light .field label { color: var(--text2); }
.input, select.input, textarea.input {
  width: 100%; background: #0f1120; border: 2px solid var(--line); border-radius: var(--radius); padding: 9px 11px; outline: none;
}
.input:focus { border-color: var(--blue); }
.light .input { background: #fff; border-color: #d6d0c2; color: var(--text); }
.light .input:focus { border-color: var(--blue); }
.err { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---------- topo ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; background: rgba(18, 20, 31, .94); backdrop-filter: blur(6px); border-bottom: 2px solid #0b0c14; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand b { font-family: var(--pix); font-size: 11px; line-height: 1.5; }
.brand small { display: block; color: var(--ink3); font-size: 12px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { background: var(--bg2); border: 2px solid #0b0c14; border-radius: var(--radius); padding: 5px 10px; min-width: 86px; }
.stat b { display: block; font-family: var(--pix); font-size: 13px; margin-top: 3px; }
.stat span { color: var(--ink3); font-size: 11.5px; }
.spacer { flex: 1; }
.queue { display: flex; align-items: center; gap: 10px; }
.queue-info { font-size: 12px; color: var(--ink2); line-height: 1.3; text-align: right; }
.queue-info b { color: var(--ink); }
.menu { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-flag { background: #ffd166; color: #3a2a00; font-family: var(--pix); font-size: 9px; padding: 5px 8px; border-radius: 3px; border: 2px solid #0b0c14; }

/* ---------- mapa ---------- */
.floor { padding: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 22px; align-content: start;
  min-height: calc(100vh - 70px);
  background-color: #191c2b;
  background-image: linear-gradient(#1f2233 2px, transparent 2px), linear-gradient(90deg, #1f2233 2px, transparent 2px);
  background-size: 32px 32px; }
.alerts { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.alert { background: #3a2a10; border: 2px solid #0b0c14; color: #ffd9a0; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }
.alert.red { background: #3d1518; color: #ffc1c3; }
.alert button { margin-left: 8px; }

.room { --c: #4f8cff; position: relative; border: 4px solid #0b0c14; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 0 #0b0c14;
  display: flex; flex-direction: column;
  /* piso quadriculado em toda a sala (inclusive embaixo das mesas e dos botões) */
  background-color: #e8dcc4;
  background-image: linear-gradient(45deg, #e1d3b8 25%, transparent 25%, transparent 75%, #e1d3b8 75%), linear-gradient(45deg, #e1d3b8 25%, transparent 25%, transparent 75%, #e1d3b8 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px; }
.room-wall { position: relative; height: 54px; background: #3a3550; border-bottom: 4px solid #0b0c14; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.room-wall::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--c); }
.room-wall .window { width: 34px; height: 24px; background: linear-gradient(180deg, #9fd3ff, #d9f0ff); border: 3px solid #0b0c14; box-shadow: inset 0 0 0 2px #fff6; }
.sign { background: #0f1120; border: 2px solid #0b0c14; padding: 6px 9px; border-radius: 3px; display: flex; align-items: center; gap: 9px; min-width: 0; }
.sign .ddd { font-family: var(--pix); font-size: 10px; background: var(--c); color: #fff; padding: 4px 6px; border-radius: 2px; text-shadow: 1px 1px 0 #0006; }
.sign .tname { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-wall .q { margin-left: auto; text-align: right; font-size: 11px; color: #d8d4ea; line-height: 1.25; }
.room-wall .q b { font-family: var(--pix); font-size: 11px; color: #fff; }
.room-floor { flex: 1; align-content: start; padding: 14px 10px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.room-add { min-height: 220px; border: 4px dashed #3a3f63; border-radius: 6px; background: transparent; color: var(--ink2); font-weight: 700; font-size: 15px; line-height: 1.5; cursor: pointer; padding: 20px; }
.room-add small { font-weight: 400; color: var(--ink3); }
.room-add:hover { border-color: var(--blue); color: var(--ink); background: #4f8cff12; }
.room-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 2px 10px 14px; }
.room-wall { flex: none; }
.btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateY(-2px); box-shadow: 0 5px 0 #0b0c14, 0 0 0 4px #4f8cff55; } }
.room-floor .rug { grid-column: 1 / -1; }

.desk { position: relative; display: grid; justify-items: center; padding: 30px 4px 8px; border-radius: 6px; cursor: pointer; border: 2px solid transparent;
  transition: background .15s, border-color .15s; color: var(--text); }
.desk:hover { background: #0000000d; border-color: #0000001a; }
.desk.me { background: #4f8cff1f; border-color: #4f8cff88; }
.desk.me::before { content: 'VOCÊ'; position: absolute; top: 4px; left: 6px; font-family: var(--pix); font-size: 7px; color: #2c5fc7; }
.desk svg.scene { width: 144px; height: 126px; image-rendering: pixelated; shape-rendering: crispEdges; display: block; }
.desk .plate { margin-top: 2px; background: #2a2738; color: #fff; border: 2px solid #0b0c14; padding: 3px 8px; border-radius: 3px; font-weight: 700; font-size: 12.5px;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk .meta { margin-top: 5px; font-size: 11.5px; color: #4b4757; text-align: center; line-height: 1.35; min-height: 32px; }
.desk .meta .chip { font-weight: 600; color: #2a2738; }
.desk .meta .warn { color: #c4262c; font-weight: 700; }
.desk .meta .idle { color: #8a6a2a; }
.desk .count { font-family: var(--pix); font-size: 9px; }
.bar { width: 120px; height: 7px; background: #0000001f; border: 2px solid #2a2738; border-radius: 2px; margin: 5px auto 0; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); width: 0; transition: width 1s linear; }

.bubble { position: absolute; top: 4px; left: calc(50% + 26px); background: #fff; color: #111; border: 2px solid #0b0c14; border-radius: 4px; padding: 4px 7px;
  font-family: var(--pix); font-size: 9px; box-shadow: 0 2px 0 #0b0c14; animation: bob 1.2s ease-in-out infinite; z-index: 2; }
.bubble::after { content: ''; position: absolute; left: 10px; bottom: -7px; width: 8px; height: 8px; background: #fff; border-right: 2px solid #0b0c14; border-bottom: 2px solid #0b0c14; transform: rotate(45deg); }
.bubble.hot { background: var(--red); color: #fff; }
.bubble.hot::after { background: var(--red); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.desk.empty { color: #7d7563; }
.desk.empty .ghostdesk { width: 144px; height: 126px; border: 3px dashed #b9ab8e; border-radius: 6px; display: grid; place-items: center; text-align: center;
  font-size: 12px; font-weight: 600; padding: 10px; }

/* animações dentro da cena */
.typing .hand-l { animation: typeL .5s steps(2) infinite; }
.typing .hand-r { animation: typeR .5s steps(2) infinite; }
@keyframes typeL { 50% { transform: translateY(-1px); } }
@keyframes typeR { 0% { transform: translateY(-1px); } 50% { transform: translateY(0); } }
.glow { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .45; } }
.alarm { animation: alarm .6s steps(2) infinite; }
@keyframes alarm { 50% { opacity: .2; } }

/* ---------- gaveta de conversas ---------- */
.drawer-bg { position: fixed; inset: 0; background: #0008; z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1000px, 100%); z-index: 41; display: grid; grid-template-columns: 340px 1fr;
  background: var(--paper); color: var(--text); border-left: 4px solid #0b0c14; box-shadow: -8px 0 0 #0005; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.list-pane { border-right: 2px solid #d9d2c3; display: flex; flex-direction: column; min-height: 0; background: var(--paper2); }
.list-head { padding: 14px; border-bottom: 2px solid #d9d2c3; }
.list-head h2 { margin: 0 0 2px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.list-head .sub { font-size: 12px; color: var(--text2); }
.tabs { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.tab { border: 2px solid #cfc7b5; background: #fff; border-radius: 3px; padding: 4px 8px; font-size: 12px; font-weight: 600; color: var(--text2); }
.tab.on { background: #2a2738; color: #fff; border-color: #2a2738; }
.tab .n { margin-left: 4px; background: var(--red); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; }
.list { overflow-y: auto; flex: 1; }
.item { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #ddd6c7; cursor: pointer; align-items: center; }
.item:hover { background: #fff8; }
.item.on { background: #fff; box-shadow: inset 4px 0 0 var(--blue); }
.avatar { width: 38px; height: 38px; border-radius: 4px; display: grid; place-items: center; font-weight: 700; color: #fff; border: 2px solid #0b0c14; font-size: 13px; }
.item .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .pv { color: var(--text2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .rt { text-align: right; font-size: 11px; color: var(--text2); display: grid; gap: 4px; justify-items: end; }
.unread { background: var(--green); color: #0b2a17; font-weight: 800; border-radius: 10px; padding: 0 7px; font-size: 11.5px; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 3px; background: #e3ddd0; color: #4b4757; white-space: nowrap; }
.pill.novo { background: #e7e3f6; color: #4c3d99; }
.pill.enviado { background: #dfeaff; color: #2453b3; }
.pill.respondeu { background: #ffe9c2; color: #8a5200; }
.pill.atendimento { background: #d7f4e3; color: #17663c; }
.pill.fechado { background: #2bb673; color: #fff; }
.pill.perdido { background: #eee; color: #888; }
.pill.invalido, .pill.erro { background: #ffdcdc; color: #a12127; }
.empty-list { padding: 30px 18px; color: var(--text2); text-align: center; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 2px solid #d9d2c3; display: flex; gap: 12px; align-items: center; background: #fff; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { font-size: 15px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who span { font-size: 12px; color: var(--text2); }
.chat-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: minmax(0, 1fr); min-height: 0; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-main .msgs { flex: 1; }
.msgs { overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 6px;
  background-color: #efe7da; background-image: radial-gradient(#e2d7c4 1px, transparent 1px); background-size: 14px 14px; }
.msg { max-width: 78%; padding: 7px 10px 5px; border-radius: 6px; background: #fff; box-shadow: 0 1px 0 #0000001f; white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg .t { display: block; text-align: right; font-size: 10.5px; color: #8b8794; margin-top: 2px; }
.msg.auto { border: 2px dashed #9fd49a; }
.day { align-self: center; font-size: 11px; background: #fff9; padding: 2px 10px; border-radius: 3px; color: var(--text2); margin: 6px 0; }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 2px solid #d9d2c3; background: #fff; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 42px; }
.side { border-left: 2px solid #d9d2c3; padding: 14px; overflow-y: auto; background: var(--paper2); }
.side h4 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); }
.side h4:first-child { margin-top: 0; }
.note { background: #fff6c9; border: 2px solid #e8d77a; border-radius: 3px; padding: 8px 10px; font-size: 12.5px; white-space: pre-wrap; word-wrap: break-word; }
.kv { font-size: 12.5px; display: grid; gap: 3px; }
.kv span { color: var(--text2); }
.nochat { display: grid; place-items: center; height: 100%; color: var(--text2); text-align: center; padding: 30px; }
.close-x { border: 2px solid #22212a; background: #fff; border-radius: 3px; width: 34px; height: 34px; font-size: 18px; line-height: 1; box-shadow: 0 2px 0 #22212a; }
.back { display: none; }

/* ---------- modais ---------- */
.modal-bg { position: fixed; inset: 0; background: #000a; z-index: 60; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--paper); color: var(--text); border: 4px solid #0b0c14; border-radius: 6px;
  box-shadow: 0 8px 0 #0b0c14; animation: pop .15s ease-out; }
.modal.narrow { width: min(460px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 2px solid #d9d2c3; position: sticky; top: 0; background: var(--paper); z-index: 1; }
.modal-head h3 { margin: 0; font-family: var(--pix); font-size: 12px; line-height: 1.5; flex: 1; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 2px solid #d9d2c3; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.help { font-size: 12.5px; color: var(--text2); margin: 4px 0 14px; }
.section-title { font-family: var(--pix); font-size: 10px; margin: 22px 0 12px; color: #2a2738; }
.section-title:first-child { margin-top: 0; }
.chips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.chipcard { background: #fff; border: 2px solid #22212a; border-radius: 4px; padding: 12px; box-shadow: 0 3px 0 #22212a; display: grid; gap: 8px; }
.chipcard .row { display: flex; align-items: center; gap: 8px; }
.chipcard .lbl { font-weight: 700; flex: 1; }
.dot { width: 10px; height: 10px; border-radius: 2px; border: 2px solid #0b0c14; display: inline-block; flex: none; }
.dot.open { background: var(--green); } .dot.connecting { background: var(--amber); } .dot.close { background: var(--red); }
.chipcard .err-line { font-size: 11.5px; color: #a12127; }
.qrbox { display: grid; place-items: center; gap: 12px; text-align: center; }
.qrbox img { width: 264px; height: 264px; image-rendering: pixelated; border: 4px solid #22212a; background: #fff; }
.steps { text-align: left; font-size: 13px; margin: 0; padding-left: 20px; }
.drop { display: block; border: 3px dashed #b9ab8e; border-radius: 6px; padding: 26px; text-align: center; background: #fff8; cursor: pointer; }
.drop.over { border-color: var(--blue); background: #4f8cff14; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #ddd6c7; }
table.t th { font-size: 11px; text-transform: uppercase; color: var(--text2); letter-spacing: .04em; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.vars button { border: 2px solid #cfc7b5; background: #fff; border-radius: 3px; font-size: 12px; padding: 2px 8px; font-family: ui-monospace, monospace; }
.vars .phr { display: inline-flex; }
.vars .phr button { font-family: var(--ui); }
.vars .phr button:first-child { border-radius: 3px 0 0 3px; }
.vars .phr .x { border-left: none; border-radius: 0 3px 3px 0; color: #a12127; padding: 2px 7px; font-weight: 700; }
.vars .phr .x:hover { background: #ffdcdc; }
.vars .addphr { font-family: var(--ui); border-style: dashed; color: #2453b3; font-weight: 600; }
#phrForm .input { flex: 1; }
.cred { background: #fff; border: 2px solid #22212a; border-radius: 4px; padding: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; white-space: pre-wrap; word-break: break-all; user-select: all; }
.preview { background: var(--bubble-out); border-radius: 6px; padding: 10px 12px; font-size: 13.5px; box-shadow: 0 1px 0 #0002; white-space: pre-wrap; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { border: 2px solid #cfc7b5; border-radius: 3px; padding: 4px 8px; background: #fff; font-size: 12.5px; cursor: pointer; user-select: none; }
.days input { display: none; }
.days label:has(input:checked) { background: #2a2738; color: #fff; border-color: #2a2738; }
.teamrow { display: grid; grid-template-columns: 34px 1fr 90px 80px 44px; gap: 10px; align-items: center; margin-bottom: 8px; }
.teamrow input[type=color] { width: 34px; height: 34px; padding: 0; border: 2px solid #22212a; border-radius: 3px; background: none; }
.tabbar { display: flex; gap: 6px; padding: 10px 18px 0; border-bottom: 2px solid #d9d2c3; }
.tabbar button { border: 2px solid transparent; border-bottom: none; background: none; padding: 8px 12px; font-weight: 700; color: var(--text2); border-radius: 4px 4px 0 0; margin-bottom: -2px; }
.tabbar button.on { background: var(--paper); border-color: #d9d2c3; color: var(--text); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: #22212a; color: #fff; border: 2px solid #0b0c14; padding: 10px 14px; border-radius: 4px; box-shadow: 0 4px 0 #0b0c14; font-weight: 600; animation: pop .15s; max-width: 90vw; }
.toast.err { background: #a12127; }
.toast.ok { background: #17663c; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .drawer { grid-template-columns: 1fr; }
  .drawer.chatting .list-pane { display: none; }
  .drawer:not(.chatting) .chat-pane { display: none; }
  .back { display: inline-flex; }
  .chat-body { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.show { display: block; position: absolute; inset: 64px 0 0 0; z-index: 3; }
  .top { position: static; padding: 10px 12px; gap: 8px; }
  .stats { order: 3; width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .stat { min-width: 0; padding: 4px 5px; }
  .stat span { font-size: 9.5px; display: block; line-height: 1.15; }
  .stat b { font-size: 10px; }
  .menu { width: 100%; }
  .menu .btn.small { padding: 5px 8px; font-size: 12px; }
  .queue { width: 100%; }
  .queue .btn { width: 100%; justify-content: center; }
  .chat-head { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .chat-head .avatar { display: none; }
  .chat-head .who { flex: 1 1 140px; }
  .chat-head .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-head #stSel { order: 5; flex: 1 1 100%; padding: 6px 8px; }
  .queue-info { display: none; }
  .floor { padding: 12px; gap: 14px; }
  .desk svg.scene { width: 120px; height: 105px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (min-width: 861px) { .only-mobile { display: none !important; } }

/* ficha do cliente */
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 4px 0 14px; padding: 10px 12px; background: #fff8; border: 2px solid #d9cfb9; border-radius: 4px; }
.kv { display: grid; gap: 1px; font-size: 13px; min-width: 0; }
.kv span { font-size: 11px; color: var(--text2); font-weight: 600; }
.kv div { overflow-wrap: anywhere; }
.infobox { background: #fff8; border: 2px solid #d9cfb9; border-radius: 4px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto; display: grid; gap: 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
@media (max-width: 640px) { .kvs { grid-template-columns: 1fr; } }

/* cliente esperando / lembretes */
.desk.late { animation: lateblink 1.2s steps(2, end) infinite; }
@keyframes lateblink { 50% { border-color: #e5484d; background: #e5484d22; } }
.bubble.late { white-space: nowrap; }
.bell { position: absolute; top: 4px; left: 6px; background: #f5a524; color: #111; border: 2px solid #0b0c14; border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 700; z-index: 2; }
.desk.me .bell { top: 16px; }
.pv.wait { color: #8a6a2a; font-size: 11.5px; }
.pv.wait.late { color: #c4262c; font-weight: 700; }
.pv.rem { color: #6b5a1e; font-size: 11.5px; }
.pv.rem.due, .note.rem.due { color: #a12127; font-weight: 700; }
.note.rem { background: #fff4d6; }
.note.rem.due { background: #fde2e2; }
.rem-quick { display: flex; gap: 4px; flex-wrap: wrap; }
/* respostas rápidas */
.chat-main { position: relative; }
.composer .qr-btn { padding: 6px 10px; font-size: 16px; }
.qr-pop { position: absolute; left: 10px; right: 10px; bottom: 62px; max-height: 260px; overflow: auto; background: #fff; border: 2px solid #22212a; border-radius: 4px; box-shadow: 0 4px 0 #22212a; z-index: 5; display: grid; }
.qr-pop button { display: grid; grid-template-columns: 90px 1fr; gap: 8px; text-align: left; background: none; border: 0; border-bottom: 1px solid #eee; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.qr-pop button:hover, .qr-pop button.on { background: #4f8cff14; }
.qr-pop button b { color: #2c5fc7; }
.qr-pop button span { color: #333; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qr-rows { display: grid; gap: 8px; }
.qr-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: 8px; align-items: start; }
.qr-row .qk { display: flex; align-items: center; gap: 4px; font-weight: 700; color: #2c5fc7; }
@media (max-width: 640px) { .qr-row { grid-template-columns: 1fr 44px; } .qr-row textarea { grid-column: 1; } }
/* relatório */
.rp-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rp-sum div { background: #fff; border: 2px solid #22212a; border-radius: 4px; padding: 8px 10px; display: grid; }
.rp-sum span { font-size: 11px; color: var(--text2); font-weight: 600; }
.rp-sum b { font-family: var(--pix); font-size: 14px; margin-top: 4px; }
.t.rp td, .t.rp th { white-space: nowrap; }
.rate { padding: 2px 6px; border-radius: 3px; font-weight: 700; }
.rate.good { background: #d7f4e3; color: #17663d; } .rate.mid { background: #fff0c9; color: #7a5a00; } .rate.bad { background: #fde2e2; color: #a12127; }

/* permissões */
.perms { display: grid; gap: 6px; padding: 10px 12px; background: #fff8; border: 2px solid #d9cfb9; border-radius: 4px; }
.pill.role-admin { background: #2a2738; color: #fff; }
.pill.role-leader { background: #fff0c9; color: #7a5a00; }
.pill.role-agent { background: #e6eefc; color: #2c5fc7; }

/* várias mesas e chips por funcionário */
.seats { display: grid; gap: 10px; }
.seat { border: 2px solid #d9cfb9; border-radius: 4px; padding: 10px; background: #fff8; }
.seat-top { display: grid; grid-template-columns: 1fr 140px auto; gap: 8px; }
.seat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 150px; overflow: auto; }
.chipopt { display: inline-flex; align-items: center; gap: 4px; border: 2px solid #d9cfb9; border-radius: 4px; padding: 3px 8px; font-size: 12.5px; cursor: pointer; background: #fff; }
.chipopt.on { border-color: #4f8cff; background: #4f8cff14; font-weight: 600; }
.chipopt input { margin: 0; }
@media (max-width: 640px) { .seat-top { grid-template-columns: 1fr 1fr auto; } }
