:root {
  --sidebar:#0f172a;
  --sidebar-hover:#1e293b;
  --panel-bg:#f4f7fb;
  --card-radius:20px;
}
body.app-body,
body {
  background: var(--panel-bg);
  color: #0f172a;
}
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #16213b 100%);
  min-height: 100vh;
}
.sidebar .nav-link {
  color: rgba(255,255,255,.82);
  border-radius: 14px;
  padding: .85rem 1rem;
  font-weight: 500;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255,255,255,.09);
  color: #fff;
}
.content-wrap {
  padding: 1.5rem;
}
.topbar {
  padding: .5rem 0 1.25rem;
}
.card-soft {
  border: 0;
  border-radius: var(--card-radius);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}
.metric-card {
  overflow: hidden;
}
.metric-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  font-size: 1.3rem;
}
.table thead th {
  font-size: .84rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  border-bottom-width: 1px;
}
.chat-box {
  max-height: 70vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
}
.message-in,
.message-out {
  max-width: 82%;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
}
.message-in {
  background: #fff;
}
.message-out {
  background: #dcfce7;
  margin-left: auto;
}
.qr-box img {
  max-width: 100%;
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #dbeafe, #eff6ff 40%, #f8fafc 70%);
}
.login-card {
  width: min(100%, 460px);
  border-radius: 24px;
}
.filter-card .form-control,
.filter-card .form-select,
.filter-card .btn,
textarea.form-control {
  border-radius: 14px;
}
.badge-status {
  border-radius: 999px;
  padding: .45rem .7rem;
}
@media (max-width: 991.98px) {
  .sidebar { min-height: auto; }
  .content-wrap { padding: 1rem; }
  .message-in,.message-out { max-width: 100%; }
}

.quick-actions .btn { border-radius: 14px; }
.sticky-compose { position: sticky; top: 1rem; }
.chat-box { scroll-behavior: smooth; }
.file-chip {
  display:inline-flex; align-items:center; gap:.45rem; padding:.55rem .8rem; background:#eef2ff; border-radius:999px; font-size:.9rem;
}

.table-conversas-prioridade tbody tr {
  transition: background-color .2s ease, border-color .2s ease;
}
.table-conversas-prioridade tbody tr.row-priority-bot td {
  background: #f8fafc;
}
.table-conversas-prioridade tbody tr.row-priority-baixo td {
  background: #ecfdf5;
}
.table-conversas-prioridade tbody tr.row-priority-medio td {
  background: #fffbeb;
}
.table-conversas-prioridade tbody tr.row-priority-alto td {
  background: #fef2f2;
}
.prioridade-inline-form {
  min-width: 150px;
}
.prioridade-select {
  border-radius: 12px;
  min-width: 140px;
}
.priority-legend {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: .35rem;
  border: 1px solid rgba(15, 23, 42, .08);
}
.priority-legend-bot { background: #f8fafc; }
.priority-legend-baixo { background: #ecfdf5; }
.priority-legend-medio { background: #fffbeb; }
.priority-legend-alto { background: #fef2f2; }
.row-priority-saving td {
  opacity: .72;
}
.prioridade-select:disabled {
  cursor: wait;
}

.chat-card { overflow: hidden; }
.chat-box {
  position: relative;
  padding-top: 1rem;
}
.chat-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding-bottom: .5rem;
  background: linear-gradient(180deg, rgba(244,247,251,.95), rgba(244,247,251,.75));
  backdrop-filter: blur(4px);
}
.chat-floating-actions {
  position: sticky;
  bottom: .5rem;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}
.chat-floating-actions .btn {
  pointer-events: auto;
  box-shadow: 0 10px 25px rgba(15, 23, 42, .18);
  border-radius: 999px;
}
.ajax-feedback {
  border-radius: 14px;
}
.message-text {
  word-break: break-word;
}
#loadOlderBtn {
  border-radius: 999px;
}


.message-media {
  border: 1px solid rgba(15, 23, 42, .06);
}
.message-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .6rem;
  border-radius: 999px;
  margin-bottom: .55rem;
  background: rgba(15, 23, 42, .06);
  color: #334155;
}
.message-out .message-meta-chip {
  background: rgba(22, 163, 74, .12);
  color: #166534;
}
.chat-toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  z-index: 1080;
  pointer-events: none;
}
.chat-toast {
  min-width: min(320px, calc(100vw - 2rem));
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .85rem .95rem;
  border-radius: 18px;
  background: rgba(15, 23, 42, .96);
  color: #fff;
  box-shadow: 0 20px 45px rgba(15, 23, 42, .22);
  transform: translateY(10px) scale(.98);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
}
.chat-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.chat-toast.is-hiding {
  opacity: 0;
  transform: translateY(8px) scale(.98);
}
.chat-toast-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.14);
  flex: 0 0 auto;
}
.chat-toast-body {
  flex: 1 1 auto;
  font-size: .92rem;
  line-height: 1.35;
}
.chat-toast-close {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.8);
  padding: .2rem;
  line-height: 1;
}
.chat-toast-message .chat-toast-icon {
  background: rgba(59,130,246,.22);
}
.chat-toast-attachment .chat-toast-icon {
  background: rgba(16,185,129,.22);
}
@media (max-width: 767.98px) {
  .chat-toast-stack {
    left: .75rem;
    right: .75rem;
    bottom: .75rem;
  }
  .chat-toast {
    min-width: 0;
    max-width: none;
  }
}
