[hidden] { display: none !important; }
:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #dc2626;
  --warn: #b45309;
  --ok: #15803d;
  --soft: #f8fafc;
  --text: #0f172a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: #f1f5f9; color: var(--text); }
button, input, textarea, select { font: inherit; }
button { border: 0; border-radius: 12px; background: var(--accent); color: white; padding: 10px 14px; font-weight: 700; cursor: pointer; }
button:hover { background: var(--accent-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: #e2e8f0; color: #0f172a; }
.login-shell { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top left, #164e63, #0f172a 45%, #020617); padding: 24px; }
.login-card { width: min(420px, 100%); background: rgba(255,255,255,.96); border: 1px solid rgba(255,255,255,.4); border-radius: 28px; box-shadow: 0 25px 70px rgba(0,0,0,.32); padding: 30px; display: grid; gap: 14px; }
.brand-mark { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, #0f766e, #0891b2); color: white; font-weight: 900; letter-spacing: .08em; }
.login-card h1 { margin: 0; font-size: 28px; }
.login-card p { margin: 0 0 6px; color: var(--muted); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: #334155; }
input, textarea, select { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: white; color: var(--text); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.error-message { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: #0f172a; color: white; }
.topbar strong { display: block; font-size: 17px; }
.topbar span { color: #cbd5e1; font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.layout { height: calc(100vh - 64px); display: grid; grid-template-columns: 340px minmax(360px, 1fr) 320px; gap: 1px; background: var(--line); }
.sidebar, .chat-panel, .details-panel { background: var(--panel); min-height: 0; }
.sidebar { display: flex; flex-direction: column; }
.filter-box { padding: 12px; display: grid; grid-template-columns: 1fr; gap: 8px; border-bottom: 1px solid var(--line); }
.conversation-list { overflow: auto; }
.conversation-item { display: grid; gap: 5px; padding: 13px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conversation-item:hover, .conversation-item.active { background: #ecfeff; }
.conversation-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conversation-name { font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-phone, .conversation-preview, .conversation-meta { color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.unread { min-width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--accent); color: white; font-size: 12px; font-weight: 800; }
.status-chip { display: inline-block; border-radius: 999px; padding: 3px 8px; background: #e2e8f0; color: #334155; font-size: 11px; font-weight: 800; }
.chat-panel { min-width: 0; }
.empty-state { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.chat-view { height: 100%; display: grid; grid-template-rows: auto 1fr auto auto; min-height: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-header h2 { margin: 0; font-size: 18px; }
.chat-header span { color: var(--muted); font-size: 13px; }
.window-badge { border-radius: 999px; padding: 6px 10px; background: #dcfce7; color: #166534; font-size: 12px; font-weight: 900; }
.window-badge.closed { background: #fee2e2; color: #991b1b; }
.messages { overflow: auto; padding: 18px; background: #f8fafc; display: flex; flex-direction: column; gap: 10px; }
.message { max-width: min(640px, 88%); padding: 10px 12px; border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.08); white-space: pre-wrap; word-break: break-word; }
.message.inbound { align-self: flex-start; background: white; border-bottom-left-radius: 4px; }
.message.outbound { align-self: flex-end; background: #ccfbf1; border-bottom-right-radius: 4px; }
.message-meta { display: flex; gap: 8px; margin-top: 5px; color: #64748b; font-size: 11px; }
.quick-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: white; align-items: end; }
.composer textarea { resize: vertical; min-height: 54px; max-height: 160px; }
.send-hint { min-height: 26px; color: var(--muted); font-size: 12px; padding: 0 14px 10px; }
.details-panel { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.details-panel h3 { margin: 0 0 4px; }
.info-card { background: var(--soft); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.info-card p { margin: 8px 0; color: #334155; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; color: #334155; font-size: 12px; }

.chat-title-area { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mobile-back { display: none; padding: 8px 10px; border-radius: 10px; background: #e2e8f0; color: #0f172a; white-space: nowrap; }

@media (max-width: 1100px) { .layout { grid-template-columns: 300px 1fr; } .details-panel { display: none; } }
@media (max-width: 760px) {
  html, body { width: 100%; min-height: 100%; overflow: hidden; }
  body { background: #fff; }

  .login-shell { min-height: 100dvh; padding: 14px; }
  .login-card { border-radius: 22px; padding: 22px; }
  .login-card h1 { font-size: 24px; }

  .topbar {
    min-height: 74px;
    height: auto;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
  }
  .topbar > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .top-actions { width: 100%; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
  .top-actions button { padding: 9px 10px; border-radius: 10px; }
  #agentName { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; align-self: center; }

  .layout {
    height: calc(100dvh - 92px);
    display: block;
    overflow: hidden;
    background: #fff;
  }
  .sidebar { display: flex; height: 100%; min-height: 0; }
  .filter-box { position: sticky; top: 0; z-index: 2; background: #fff; padding: 10px; }
  .conversation-list { flex: 1; min-height: 0; }
  .conversation-item { padding: 14px 12px; }

  .chat-panel { display: none; height: 100%; min-height: 0; }
  .details-panel { display: none; }

  .app-shell.chat-open .sidebar { display: none; }
  .app-shell.chat-open .chat-panel { display: block; height: 100%; }
  .app-shell.chat-open .details-panel {
    display: flex;
    height: auto;
    max-height: 42dvh;
    overflow: auto;
    border-top: 1px solid var(--line);
    padding: 12px;
  }
  .app-shell.chat-open .layout { overflow-y: auto; -webkit-overflow-scrolling: touch; }

  .mobile-back { display: inline-flex; align-items: center; justify-content: center; }
  .chat-title-area { flex: 1; min-width: 0; }
  .chat-title-area > div { min-width: 0; }
  .chat-header { padding: 10px 12px; gap: 8px; }
  .chat-header h2 { font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 46vw; }
  .chat-header span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 46vw; }
  .window-badge { padding: 5px 8px; font-size: 11px; max-width: 38vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

  .chat-view { height: 100%; min-height: 0; grid-template-rows: auto 1fr auto auto auto; }
  .messages { padding: 12px; gap: 8px; }
  .message { max-width: 92%; font-size: 14px; }
  .quick-row { padding: 8px 10px; grid-template-columns: 1fr auto; }
  .quick-row button { padding: 9px 10px; }
  .composer { padding: 9px 10px; gap: 8px; grid-template-columns: 1fr auto; }
  .composer textarea { min-height: 46px; max-height: 110px; padding: 10px; }
  .composer button { padding: 10px 12px; }
  .send-hint { padding: 0 10px 8px; font-size: 11px; }
  .info-card { border-radius: 14px; padding: 12px; }
  .toast { right: 10px; bottom: 10px; max-width: calc(100vw - 20px); }
}

@media (max-width: 420px) {
  .top-actions { grid-template-columns: 1fr auto auto; }
  .top-actions button { font-size: 13px; padding: 8px; }
  .brand-mark { width: 50px; height: 50px; }
  .window-badge { max-width: 34vw; }
  .chat-header h2, .chat-header span { max-width: 42vw; }
  .quick-row { grid-template-columns: 1fr; }
  .composer { grid-template-columns: 1fr; }
  .composer button { width: 100%; }
}

/* Ajustes de performance/UX da versão otimizada */
.conversation-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  font-weight: 400;
  box-shadow: none;
}
.conversation-item:hover,
.conversation-item.active {
  background: #ecfeff;
  color: var(--text);
}
.conversation-item:focus-visible {
  outline: 2px solid rgba(15,118,110,.35);
  outline-offset: -2px;
}
.empty-state small {
  display: block;
  margin-top: 8px;
  color: #94a3b8;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 14px;
  background: #0f172a;
  color: white;
  box-shadow: 0 18px 50px rgba(15,23,42,.28);
  font-size: 14px;
  font-weight: 700;
}
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }
.toast.info { background: #0f172a; }

/* Roteamento de atendimento */
.conversation-assigned {
  color: #64748b;
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.assignment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}
.assignment-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.assignment-card strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
}
.assignment-card strong.mine {
  color: #0f766e;
}
#claimBtn, #transferBtn {
  color: #0f172a;
}

/* Mídias V1 */
.message-body { white-space: pre-wrap; }
.media-box {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: rgba(248,250,252,.9);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 6px;
  max-width: 100%;
}
.message.outbound .media-box { background: rgba(240,253,250,.75); }
.media-box.muted { color: #64748b; font-size: 13px; }
.media-box.error { color: #991b1b; background: #fee2e2; border-color: #fecaca; font-size: 13px; }
.media-name { font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-size { color: #64748b; font-size: 12px; }
.media-load-btn,
.media-open-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: none;
}
.media-load-btn:hover,
.media-open-btn:hover { background: #f1f5f9; }
.media-load-btn:disabled { opacity: .7; cursor: wait; }
.media-preview {
  display: block;
  max-width: min(360px, 100%);
  max-height: 360px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
}
.media-audio { width: min(340px, 100%); }
.media-video {
  display: block;
  max-width: min(420px, 100%);
  max-height: 360px;
  border-radius: 12px;
  background: #000;
}
@media (max-width: 760px) {
  .media-preview, .media-video { max-width: 100%; max-height: 300px; }
  .media-audio { width: 100%; }
}

/* Fila privada V1.2 */
.conversation-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.conversation-item.locked { background: #fff; }
.conversation-item.active { background: #ecfeff; }
.conversation-main {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 5px;
  padding: 13px 8px 13px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 400;
  min-width: 0;
}
.conversation-main:hover { background: transparent; color: var(--text); }
.conversation-dots {
  align-self: start;
  margin: 10px 8px 0 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 18px;
  line-height: 1;
}
.conversation-dots:hover { background: #dbeafe; color: #0f172a; }
.conversation-badges { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.privacy-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.locked-card {
  align-self: center;
  margin: auto;
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(15,23,42,.08);
}
.locked-card h3 { margin: 0 0 8px; }
.locked-card p { color: var(--muted); margin: 0 0 16px; }
.context-menu {
  position: fixed;
  z-index: 10000;
  width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 18px 60px rgba(15,23,42,.22);
}
.context-menu button {
  width: 100%;
  display: block;
  text-align: left;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  font-weight: 800;
}
.context-menu button:hover { background: #f1f5f9; }
.context-menu button.danger { color: #991b1b; }
.context-menu button.danger:hover { background: #fee2e2; }
.menu-empty { color: var(--muted); font-size: 13px; padding: 9px 10px; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: grid;
  place-items: center;
  background: rgba(15,23,42,.46);
  padding: 20px;
}
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(15,23,42,.32);
  display: grid;
  gap: 12px;
}
.modal-card h3 { margin: 0; }
.modal-card p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 760px) {
  .conversation-main { padding: 13px 6px 13px 12px; }
  .conversation-dots { margin-right: 6px; }
  .context-menu { right: 8px !important; left: auto !important; }
  .modal-card { border-radius: 18px; }
}

/* V1.3 — Chat mais leve, privado e com mais vida */
:root {
  --accent: #128c7e;
  --accent-dark: #075e54;
  --chat-bg: #efeae2;
  --bubble-in: #ffffff;
  --bubble-out: #dcf8c6;
  --bubble-pending: #e8f7ff;
}
body { background: #e8eef2; }
.topbar {
  background: linear-gradient(135deg, #075e54, #128c7e);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.topbar button { border-radius: 999px; padding: 8px 12px; }
.layout { background: #d6dee4; grid-template-columns: 344px minmax(360px, 1fr) 310px; }
.sidebar { background: #f8fafc; }
.filter-box { background: #f8fafc; }
.conversation-list { scrollbar-width: thin; }
.conversation-item { background: #fff; transition: background .08s ease; }
.conversation-item:hover { background: #f0fdfa; }
.conversation-item.active { background: #ddf7f1; box-shadow: inset 4px 0 0 var(--accent); }
.conversation-name { color: #0f172a; }
.conversation-preview { color: #64748b; }
.conversation-item.locked .conversation-name { color: #334155; }
.conversation-item.locked .conversation-preview { color: #9a3412; }
.privacy-chip { background: #ffedd5; color: #9a3412; }
.unread { background: #25d366; color: #052e16; }
.chat-panel { background: var(--chat-bg); }
.chat-header {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}
.chat-view { background: var(--chat-bg); }
.messages {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.55), transparent 24%),
    radial-gradient(circle at 90% 80%, rgba(18,140,126,.08), transparent 28%),
    var(--chat-bg);
}
.message {
  border: 0;
  box-shadow: 0 1px 2px rgba(15,23,42,.09);
  line-height: 1.38;
}
.message.inbound { background: var(--bubble-in); border-top-left-radius: 6px; }
.message.outbound { background: var(--bubble-out); border-top-right-radius: 6px; }
.message.optimistic { background: var(--bubble-pending); opacity: .92; }
.message-meta { gap: 8px; justify-content: flex-end; color: #64748b; }
.composer {
  background: rgba(255,255,255,.92);
  border-top: 1px solid rgba(148,163,184,.35);
}
.composer textarea {
  border-radius: 18px;
  min-height: 48px;
  resize: none;
  background: #fff;
}
.composer button {
  border-radius: 999px;
  min-width: 86px;
  background: #25d366;
  color: #052e16;
}
.composer button:hover { background: #1fc05d; }
.composer button.sending::after { content: '...'; }
.send-hint { background: rgba(255,255,255,.92); }
.details-panel { background: #f8fafc; }
.info-card, .assignment-card {
  background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.window-badge { background: #dcfce7; color: #166534; }
.window-badge.closed { background: #ffe4e6; color: #9f1239; }
.locked-card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(148,163,184,.35);
}
.locked-card button { border-radius: 999px; background: #25d366; color: #052e16; }
.context-menu { animation: none; }
.media-box { background: rgba(255,255,255,.7); }
.media-load-btn, .media-open-btn { border-radius: 999px; }
.quick-row { display: none !important; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .chat-view { background: var(--chat-bg); }
  .details-panel { background: #f8fafc; }
}

/* V2.6 - Fila separada e privacidade forte */
.conversation-section-title {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: #eef6f4;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.conversation-section-title strong {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #ccfbf1;
  color: #115e59;
  font-size: 11px;
}
.queue-hint {
  margin-left: auto;
  color: #0f766e;
  font-weight: 900;
  font-size: 11px;
}
.conversation-item.locked .conversation-main { cursor: default; }
.conversation-item.locked:hover { background: #fffaf0; }

/* SGP Card v2.8 */
.sgp-card-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.sgp-card-head h3 { margin:0; }
button.mini { padding:6px 10px; font-size:12px; border-radius:999px; }
.sgp-box { font-size:13px; line-height:1.45; color:#0f172a; }
.sgp-box pre, .sgp-raw { white-space:pre-wrap; overflow:auto; max-height:280px; background:#0f172a; color:#e2e8f0; padding:10px; border-radius:12px; }
.sgp-empty { background:#f1f5f9; border:1px dashed #cbd5e1; border-radius:14px; padding:12px; color:#475569; display:grid; gap:4px; }
.sgp-empty small { color:#64748b; }
.sgp-client { display:grid; gap:8px; }
.sgp-client h4 { margin:0; font-size:16px; color:#0f172a; }
.sgp-client p { margin:0; color:#334155; }
.sgp-found { display:inline-flex; width:max-content; background:#dcfce7; color:#166534; border:1px solid #86efac; border-radius:999px; padding:4px 8px; font-weight:800; font-size:12px; }
.sgp-tags { display:flex; flex-wrap:wrap; gap:6px; }
.sgp-tags span { background:#e0f2fe; color:#075985; border:1px solid #bae6fd; padding:3px 7px; border-radius:999px; font-weight:700; font-size:12px; }
.sgp-contract { background:#fff; border:1px solid #e2e8f0; box-shadow:0 6px 16px rgba(15,23,42,.05); border-radius:14px; padding:10px; display:grid; gap:6px; }
.sgp-contract.maintenance { border-color:#fbbf24; background:#fffbeb; }
.sgp-contract-head { display:flex; justify-content:space-between; gap:8px; align-items:center; }
.sgp-contract-head span { background:#f1f5f9; border-radius:999px; padding:2px 7px; color:#64748b; font-size:11px; font-weight:800; text-transform:uppercase; }
.sgp-alert { background:#fef3c7; color:#92400e; border-radius:10px; padding:7px 8px; font-weight:700; }

/* V2.9 — Painel lateral só aparece com atendimento iniciado */
.app-shell .layout {
  grid-template-columns: 344px minmax(360px, 1fr);
}
.app-shell .details-panel {
  display: none;
}
.app-shell.details-active .layout {
  grid-template-columns: 344px minmax(360px, 1fr) 320px;
}
.app-shell.details-active .details-panel {
  display: flex;
}
.client-panel-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ecfdf5, #ffffff);
  border: 1px solid #ccfbf1;
  box-shadow: 0 8px 28px rgba(15, 118, 110, .08);
}
.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #075e54, #25d366);
  color: #fff;
  font-weight: 950;
  letter-spacing: .04em;
}
.client-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.client-main small {
  color: #0f766e;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.client-main strong {
  font-size: 17px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-main span {
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.mini-stat small {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.mini-stat strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-shell:not(.details-active) .chat-panel {
  box-shadow: none;
}
.app-shell:not(.details-active) #emptyChat h2::after {
  content: ' ou aceite um atendimento da fila';
}
@media (max-width: 1100px) {
  .app-shell .layout,
  .app-shell.details-active .layout {
    grid-template-columns: 300px 1fr;
  }
  .app-shell.details-active .details-panel {
    display: none;
  }
}
@media (max-width: 760px) {
  .app-shell .layout,
  .app-shell.details-active .layout {
    grid-template-columns: 1fr;
  }
  .app-shell.chat-open .details-panel {
    display: none !important;
  }
  .app-shell.chat-open.details-active .details-panel {
    display: flex !important;
    height: auto;
    max-height: 42dvh;
    overflow: auto;
    border-top: 1px solid var(--line);
    padding: 12px;
  }
  .client-mini-grid { grid-template-columns: 1fr 1fr; }
}

/* V3.0 — Barra superior inteligente + lateral sanfonada */
.chat-view { grid-template-rows: auto auto 1fr auto auto; }
.smart-contact-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, #ffffff, #f8fafc);
  border-bottom: 1px solid rgba(148,163,184,.35);
  box-shadow: 0 1px 0 rgba(15,23,42,.03);
}
.smart-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.smart-avatar {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #075e54, #25d366);
  color: #fff; font-weight: 950; letter-spacing: .04em;
  box-shadow: 0 8px 20px rgba(7,94,84,.18);
}
.smart-identity { display: grid; gap: 2px; min-width: 0; }
.smart-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.smart-name-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.smart-identity span, .smart-identity small { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-identity small { font-size: 11px; color: #64748b; }
.smart-chip, .smart-pill {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 4px 8px;
  font-size: 11px; font-weight: 900; white-space: nowrap;
  border: 1px solid transparent;
}
.smart-chip.normal { background: #dcfce7; color: #166534; border-color: #86efac; }
.smart-indicators { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.smart-pill { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.smart-pill.ok { background: #dcfce7; color: #166534; border-color: #86efac; }
.smart-pill.warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.smart-pill.bad { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }
.smart-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.icon-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: #f1f5f9; color: #334155;
  border: 1px solid #e2e8f0; font-size: 17px;
}
.icon-btn:hover { background: #e2e8f0; color: #0f172a; }
.icon-btn.danger { background: #fff1f2; color: #e11d48; border-color: #fecdd3; }
.icon-btn.danger:hover { background: #ffe4e6; color: #be123c; }

.details-panel { padding: 0; gap: 0; background: #f8fafc; }
.accordion-panel-shell { display: flex; flex-direction: column; width: 100%; }
.accordion-toggle {
  width: 100%; min-height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  border: 0; border-radius: 0;
  padding: 0 16px;
  background: #ffffff; color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 900; text-align: left;
}
.accordion-toggle:hover { background: #f8fafc; color: #0f766e; }
.accordion-toggle strong { font-size: 22px; transition: transform .16s ease; color: #64748b; }
.accordion-toggle.active strong { transform: rotate(90deg); color: #0f766e; }
.accordion-toggle.active { background: #ecfdf5; color: #0f766e; }
.accordion-panel {
  display: none;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.accordion-panel.active { display: grid; }
.compact-card { padding: 12px; border-radius: 14px; }
.compact-card h3 { margin: 0 0 8px; font-size: 15px; }
.side-list-empty {
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 12px;
  color: #64748b;
  font-weight: 700;
  font-size: 13px;
}
.side-list { display: grid; gap: 8px; }
.side-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px;
  display: grid; gap: 4px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.side-item strong { color: #0f172a; font-size: 13px; }
.side-item span, .side-item small { color: #64748b; font-size: 12px; }
.side-item.warn { border-color: #fde68a; background: #fffbeb; }
.side-item.ok { border-color: #bbf7d0; background: #f0fdf4; }

@media (max-width: 900px) {
  .smart-contact-bar { grid-template-columns: 1fr; gap: 10px; }
  .smart-indicators, .smart-actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .smart-contact-bar { padding: 10px 12px; }
  .smart-actions { display: none; }
  .smart-indicators { gap: 5px; }
  .smart-pill { font-size: 10px; padding: 3px 7px; }
  .app-shell.chat-open.details-active .details-panel { max-height: 48dvh; }
}
.side-scroll-btn {
  justify-self: start;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 12px;
}
.side-scroll-btn:hover { background: #cbd5e1; }
.pulse-message { outline: 3px solid rgba(37, 211, 102, .45); animation: pulseMsg 1.2s ease; }
@keyframes pulseMsg { 0% { transform: scale(1); } 45% { transform: scale(1.015); } 100% { transform: scale(1); } }

/* V3.1 — Ícones elegantes, confirmação e notificações sonoras */
.icon-btn svg,
.sound-toggle svg,
.acc-title svg,
.confirm-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn svg { width: 19px; height: 19px; }
.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #e2e8f0;
}
.sound-toggle svg { width: 17px; height: 17px; }
.sound-toggle.off {
  opacity: .68;
}
.sound-toggle.off svg path:first-child {
  opacity: .55;
}
.acc-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.acc-title svg {
  width: 17px;
  height: 17px;
  color: #475569;
  flex: 0 0 auto;
}
.accordion-toggle.active .acc-title svg,
.accordion-toggle:hover .acc-title svg {
  color: #0f766e;
}
.smart-actions .icon-btn {
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.smart-actions .icon-btn:hover {
  transform: translateY(-1px);
}
.smart-actions .icon-btn:disabled {
  transform: none;
  opacity: .5;
  cursor: not-allowed;
}
.legacy-transfer {
  display: none !important;
}
.confirm-card {
  text-align: center;
}
.confirm-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 2px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}
.confirm-icon svg {
  width: 26px;
  height: 26px;
}
.danger-action {
  background: #e11d48;
  color: #fff;
}
.danger-action:hover {
  background: #be123c;
}
@media (max-width: 760px) {
  .sound-toggle span { display: none; }
  .sound-toggle { justify-content: center; }
}

/* V3.2 — Faturas SGP */
.invoice-actions-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}
.invoice-actions-head small {
  color: #64748b;
  font-size: 11px;
  text-align: right;
}
.invoice-list {
  display: grid;
  gap: 10px;
}
.invoice-card {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 11px;
  display: grid;
  gap: 7px;
  box-shadow: 0 1px 2px rgba(15,23,42,.045);
}
.invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.invoice-head strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.25;
}
.invoice-head span {
  font-size: 10px;
  border-radius: 999px;
  padding: 3px 7px;
  color: #92400e;
  background: #fef3c7;
  white-space: nowrap;
}
.invoice-card small {
  color: #64748b;
  font-size: 11px;
}
.invoice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.invoice-buttons button {
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: #064e3b;
  background: #d1fae5;
}
.invoice-buttons button:hover:not(:disabled) {
  background: #a7f3d0;
}
.invoice-buttons button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.side-list-empty.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}


/* V3.3 - envio de anexos */
.composer { padding: 10px 12px; }
.composer-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 9px; align-items: end; width: 100%; }
.attach-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.45);
  background: #fff;
  color: #0f766e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.attach-btn:hover { background: #ecfdf5; border-color: rgba(15,118,110,.35); transform: translateY(-1px); }
.attach-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.attach-btn.sending { background: #dcfce7; animation: attachPulse 1s ease-in-out infinite; }
.attach-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.media-box.sent-media, .media-box.optimistic-media {
  display: flex;
  align-items: center;
  gap: 8px;
  border-color: rgba(34,197,94,.24);
  background: rgba(240,253,244,.72);
}
.media-sent-icon { font-size: 18px; line-height: 1; }
.media-sending-text { font-size: 12px; color: #64748b; }
.optimistic-media .media-preview { max-height: 220px; border-radius: 12px; }
@keyframes attachPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }
@media (max-width: 560px) {
  .composer-row { grid-template-columns: 40px 1fr; }
  .composer-row #sendBtn { grid-column: 1 / -1; width: 100%; }
  .attach-btn { width: 40px; height: 40px; }
}


/* V3.4 — correções de layout e performance visual */
.chat-header[hidden] { display: none !important; }

.composer {
  display: block !important;
  padding: 12px 14px !important;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
}
.composer-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: end !important;
  width: 100% !important;
  max-width: 100% !important;
}
.composer textarea {
  min-height: 48px !important;
  max-height: 132px !important;
  resize: vertical;
  border-radius: 18px !important;
  padding: 13px 14px !important;
  line-height: 1.35;
  background: #f8fafc;
}
.composer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.attach-btn,
.send-btn {
  height: 48px !important;
  border-radius: 16px !important;
  display: inline-grid !important;
  place-items: center !important;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.attach-btn {
  width: 48px !important;
  min-width: 48px !important;
  padding: 0 !important;
  background: #f1f5f9 !important;
  color: #0f766e !important;
  border: 1px solid #dbe7e3 !important;
  box-shadow: 0 6px 18px rgba(15,23,42,.06) !important;
}
.attach-btn:hover:not(:disabled) { background: #ecfdf5 !important; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15,118,110,.12) !important; }
.attach-btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.attach-btn svg { width: 22px !important; height: 22px !important; }
.send-btn {
  min-width: 96px;
  padding: 0 18px !important;
  background: linear-gradient(135deg, #0f766e, #10b981) !important;
  color: #fff !important;
  border: 0 !important;
  font-weight: 900 !important;
  box-shadow: 0 10px 26px rgba(15,118,110,.22) !important;
}
.send-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(15,118,110,.30) !important; }
.send-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.media-file-input {
  position: fixed !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.invoice-actions-head .mini { white-space: nowrap; }
.side-list-empty.error { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
@media (max-width: 760px) {
  .composer { padding: 9px 10px !important; }
  .composer-row { grid-template-columns: 1fr auto !important; gap: 8px !important; }
  .composer-actions { gap: 6px; }
  .attach-btn, .send-btn { height: 44px !important; border-radius: 14px !important; }
  .attach-btn { width: 44px !important; min-width: 44px !important; }
  .send-btn { min-width: 76px; padding: 0 14px !important; font-size: 13px; }
  .composer textarea { min-height: 44px !important; max-height: 108px !important; padding: 11px 12px !important; }
}
@media (max-width: 420px) {
  .composer-row { grid-template-columns: 1fr !important; }
  .composer-actions { justify-content: flex-end; }
  .send-btn { min-width: 92px; }
}


/* V3.5 — correções reais: barra única, anexos nativos e faturas com feedback */
.chat-view.accepted-chat #chatHeader,
.chat-view.accepted-chat .chat-header {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}
.chat-view.accepted-chat {
  grid-template-rows: auto 1fr auto auto !important;
}
.composer-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end !important;
  gap: 10px !important;
}
.composer-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  justify-content: flex-end !important;
}
.attach-btn,
.send-btn {
  height: 48px !important;
  border-radius: 16px !important;
}
.attach-btn {
  width: 48px !important;
  min-width: 48px !important;
  cursor: pointer !important;
  user-select: none !important;
}
.attach-btn.disabled,
.attach-btn[aria-disabled="true"] {
  opacity: .45 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}
.media-file-input {
  position: fixed !important;
  left: -1000px !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0.01 !important;
  pointer-events: auto !important;
}
.invoice-loading {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.tiny-spinner {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid #ccfbf1;
  border-top-color: #0f766e;
  display: inline-block;
  animation: tinySpin .8s linear infinite;
}
#invoiceRefreshBtn.loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid rgba(15,118,110,.25);
  border-top-color: #0f766e;
  display: inline-block;
  margin-right: 6px;
  vertical-align: -2px;
  animation: tinySpin .8s linear infinite;
}
@keyframes tinySpin { to { transform: rotate(360deg); } }
@media (max-width: 420px) {
  .composer-row { grid-template-columns: minmax(0, 1fr) auto !important; }
  .send-btn { min-width: 78px !important; }
  .attach-btn { width: 44px !important; min-width: 44px !important; }
}


/* V3.6 — solução definitiva: sem barra duplicada, composer elegante, feedback de faturas */
.legacy-chat-state,
#chatHeader.legacy-chat-state,
#chatHeader[hidden],
.chat-header[hidden] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}
.chat-view.accepted-chat,
.chat-view {
  grid-template-rows: auto minmax(0, 1fr) auto auto !important;
}
.smart-contact-bar {
  border-bottom: 1px solid rgba(148, 163, 184, .22) !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .04) !important;
}
.composer {
  padding: 12px 14px !important;
  border-top: 1px solid rgba(148, 163, 184, .24) !important;
  background: rgba(255,255,255,.94) !important;
  backdrop-filter: blur(12px) !important;
}
.composer-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: end !important;
}
.composer textarea {
  min-height: 48px !important;
  max-height: 140px !important;
  resize: vertical !important;
  border-radius: 18px !important;
  padding: 13px 14px !important;
  line-height: 1.35 !important;
}
.composer-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.attach-btn,
.send-btn {
  height: 48px !important;
  border-radius: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.attach-btn {
  width: 48px !important;
  min-width: 48px !important;
  padding: 0 !important;
  border: 1px solid rgba(15, 118, 110, .18) !important;
  background: #ecfdf5 !important;
  color: #0f766e !important;
  cursor: pointer !important;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease !important;
}
.attach-btn:hover:not(.disabled) {
  transform: translateY(-1px) !important;
  background: #d1fae5 !important;
  box-shadow: 0 12px 28px rgba(15, 118, 110, .18) !important;
}
.attach-btn.disabled {
  opacity: .48 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}
.attach-btn.sending svg { animation: mswa-spin .8s linear infinite; }
.send-btn {
  min-width: 96px !important;
  padding: 0 18px !important;
  font-weight: 900 !important;
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #fff !important;
  box-shadow: 0 13px 28px rgba(15, 118, 110, .24) !important;
}
.media-file-input {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0.001 !important;
  left: 0 !important;
  bottom: 0 !important;
  z-index: -1 !important;
}
.invoice-actions-head .mini.loading,
#invoiceRefreshBtn.loading {
  opacity: .75 !important;
  pointer-events: none !important;
}
.invoice-loading {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  color: #0f766e !important;
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
}
.tiny-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(15, 118, 110, .2);
  border-top-color: #0f766e;
  display: inline-block;
  animation: mswa-spin .75s linear infinite;
}
@keyframes mswa-spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .composer-row { grid-template-columns: 1fr auto !important; gap: 8px !important; }
  .attach-btn, .send-btn { height: 44px !important; border-radius: 14px !important; }
  .attach-btn { width: 44px !important; min-width: 44px !important; }
  .send-btn { min-width: 82px !important; padding: 0 14px !important; }
}

/* V3.8 — Respostas, reações, miniaturas e gravação de áudio */
.message { position: relative; }
.msg-reply-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(15,23,42,.06);
  color: #475569;
  opacity: 0;
  transition: .15s ease;
  font-size: 13px;
  padding: 0;
}
.message:hover .msg-reply-btn { opacity: 1; }
.message.outbound .msg-reply-btn { left: 8px; right: auto; }
.msg-reply-btn:hover { background: rgba(15,118,110,.14); color: #0f766e; }
.message-quote {
  display: grid;
  gap: 2px;
  margin-bottom: 7px;
  padding: 7px 9px;
  border-left: 3px solid #0f766e;
  background: rgba(255,255,255,.62);
  border-radius: 10px;
  max-width: 100%;
}
.message-quote strong { font-size: 12px; color: #0f766e; }
.message-quote span {
  font-size: 12px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-reactions {
  display: inline-flex;
  align-self: flex-end;
  gap: 3px;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
  font-size: 14px;
  width: fit-content;
}
.message-reactions small { font-size: 10px; margin-left: 2px; color: #64748b; }
.composer { display: grid !important; grid-template-columns: 1fr !important; gap: 8px !important; }
.composer-reply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}
.composer-reply[hidden] { display: none !important; }
.composer-reply div { display: grid; gap: 1px; min-width: 0; }
.composer-reply small { color: #0f766e; font-weight: 900; text-transform: uppercase; font-size: 10px; }
.composer-reply strong { color: #0f172a; font-size: 13px; }
.composer-reply span { color: #475569; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-reply button {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #334155 !important;
  border: 1px solid #dbeafe !important;
  padding: 0 !important;
}
.composer-actions { display: flex !important; align-items: flex-end !important; gap: 7px !important; }
.mic-btn.recording {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fecaca !important;
  animation: recPulse 1s ease-in-out infinite;
}
@keyframes recPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.07)} }
.media-preview-shell {
  min-width: min(280px, 100%);
}
.document-card {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.document-card strong { font-size: 13px; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-preview { width: min(260px, 100%); max-height: 260px; object-fit: cover; border-radius: 14px; display: block; }
.media-audio { min-width: min(320px, 100%); }
.media-video { width: min(320px, 100%); border-radius: 14px; }
@media (max-width: 760px) {
  .msg-reply-btn { opacity: .9; top: 5px; }
  .composer-actions { gap: 6px !important; }
  .media-preview { max-height: 220px; }
}
