/* ============================================================
   mabeco.ai — app shell
   Design tokens + sidebar layout + components
   ============================================================ */

:root {
  /* Brand — azul-marinho oficial da marca (manual LLA Marketing) */
  --brand-500: #003049;
  --brand-600: #001f30;
  --brand-50: #e7edf1;

  /* Vermelho da logo (extraído do PNG oficial) — usar como realce pontual, não como cor primária */
  --brand-red: #d62828;
  --brand-red-dark: #b91c1c;
  --brand-red-50: #fdeaea;

  /* Laranja oficial da marca (manual de marca LLA Marketing) */
  --brand-orange: #f77f00;
  --brand-orange-50: #fff1e0;

  /* Surfaces */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e8ee;
  --border-strong: #d3d7e0;

  /* Text */
  --fg: #0f172a;
  --fg-muted: #64748b;
  --fg-subtle: #94a3b8;
  --fg-on-brand: #ffffff;

  /* Status */
  --success: #16a34a;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Spacing */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .15);

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover:not(.btn) { color: var(--brand-600); }
button { font-family: inherit; }

/* ============================================================
   App shell — sidebar + content
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  padding: 20px 16px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.sidebar .brand .brand-logo {
  height: 48px;
  width: auto;
  display: block;
  opacity: .95;
  transition: opacity .15s;
}
.sidebar .brand:hover .brand-logo { opacity: 1; }
.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #f1f5f9; font-size: 14px; font-weight: 600;
  margin-bottom: 2px;
  letter-spacing: .1px;
}
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active {
  background: rgba(214,40,40,.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-red);
}
.sidebar nav .group-label {
  font-size: 11px; text-transform: uppercase; color: var(--brand-orange);
  padding: 16px 12px 8px; letter-spacing: .8px;
  font-weight: 700;
}
.sidebar .footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(247,127,0,.4);
  font-size: 13px;
  color: #e2e8f0;
}
.sidebar .footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sidebar .footer-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-orange));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: .2px;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, .15);
}
.sidebar .footer-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.sidebar .footer-user-info { min-width: 0; flex: 1; }
.sidebar .footer-user-info .me {
  font-weight: 700;
  color: #fff;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .footer-user-info .text-xs {
  color: #94a3b8 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .footer a.signout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border-radius: 8px;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 13px;
  background: transparent;
  transition: background .15s, color .15s;
}
.sidebar .footer a.signout:hover {
  background: #1e293b;
  color: #fff;
}
.sidebar .footer a.signout svg { flex-shrink: 0; }

/* ---- Sidebar: minimizar + submenus (grupos colapsáveis) ---- */
.sidebar-top {
  padding: 16px 12px;
  border-bottom: 1px solid rgba(247,127,0,.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-top .brand { padding: 0; border: 0; justify-content: flex-start; flex: 1; min-width: 0; }
.sidebar-toggle {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #1e293b;
  cursor: pointer;
  font-family: inherit;
}
.sidebar-toggle:hover { background: #1e293b; color: #fff; }
.sidebar-toggle svg { transition: transform .2s; }

.nav-icon { flex-shrink: 0; width: 18px; text-align: center; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-group { margin-bottom: 2px; }
.group-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #f1f5f9; font-size: 14px; font-weight: 600; font-family: inherit;
  background: transparent; border: 0; cursor: pointer;
  text-align: left; letter-spacing: .1px; margin-bottom: 2px;
}
.group-toggle:hover { background: #1e293b; color: #fff; }
.group-toggle .group-label-text { flex: 1; min-width: 0; }
.group-toggle .chevron { flex-shrink: 0; transition: transform .2s; color: #94a3b8; }
.nav-group:has(.group-items.open) .chevron { transform: rotate(90deg); }
.group-items { display: none; padding-left: 14px; }
.group-items.open { display: block; }

.app.sidebar-collapsed { grid-template-columns: 68px 1fr; }
.sidebar.collapsed .sidebar-top { justify-content: center; }
.sidebar.collapsed .brand { display: none; }
.sidebar.collapsed nav { padding: 12px 8px; }
.sidebar.collapsed nav a,
.sidebar.collapsed .group-toggle { justify-content: center; padding: 10px 8px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .group-label,
.sidebar.collapsed .group-toggle .chevron { display: none; }
.sidebar.collapsed .group-items { padding-left: 0; }
.sidebar.collapsed .footer-user-info { display: none; }
.sidebar.collapsed .footer-user { justify-content: center; }
.sidebar.collapsed .footer a.signout { justify-content: center; }
.sidebar.collapsed .footer a.signout .nav-label { display: none; }

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar .page-title { font-size: 15px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .search {
  position: relative; width: 320px;
}
.topbar .search input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font-size: 13px;
}
.topbar .search input:focus { outline: 2px solid var(--brand-500); outline-offset: 0; border-color: var(--brand-500); background: #fff; }
.topbar .search::before {
  content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; opacity: .5;
}

/* Global search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-height: 480px;
  overflow-y: auto;
  z-index: 70;
}
.search-results .group-label {
  padding: 8px 14px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--fg-subtle);
}
.search-results .result {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.search-results .result:last-child { border-bottom: 0; }
.search-results .result:hover, .search-results .result.selected { background: var(--surface-2); }
.search-results .result .body { flex: 1; min-width: 0; }
.search-results .result .body .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .result .body .meta { font-size: 11.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .result mark { background: #fef08a; color: var(--fg); padding: 0 1px; border-radius: 2px; }
.search-results .empty { padding: 24px; text-align: center; color: var(--fg-subtle); font-size: 13px; }

.main { flex: 1; overflow-y: auto; padding: 24px; }
.main.flush { padding: 0; }

/* ============================================================
   Card + Section
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-header .sub { color: var(--fg-muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border-strong);
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ============================================================
   Form
   ============================================================ */
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.form-row.cols-1 { grid-template-columns: 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--fg-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--fg);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand-500);
  outline-offset: 0;
  border-color: var(--brand-500);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: 12px; color: var(--fg-subtle); margin-top: 4px; }
.field .error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.table tr:hover td { background: var(--surface-2); cursor: pointer; }
.table tr:last-child td { border-bottom: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* ============================================================
   Badge + Tag
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2px;
}
.badge-neutral { background: #eef2f7; color: #475569; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-brand   { background: var(--brand-50); color: var(--brand-500); }

.tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #eef2f7;
  color: #475569;
}

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-50), var(--brand-orange-50));
  color: var(--brand-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
img.avatar { object-fit: cover; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ============================================================
   Tabs (settings) — grupo (categoria) + subgrupo (tab da categoria)
   ============================================================ */
.tabs-groups {
  display: flex; gap: 6px; flex-wrap: wrap;
  background: var(--surface);
  padding: 12px 20px 0;
}
.tab-group-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  font-family: inherit;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.tab-group-btn:hover { color: var(--fg); border-color: var(--fg-muted); }
.tab-group-btn.active { color: #fff; background: var(--brand-500); border-color: var(--brand-500); }

.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 20px 0;
}
.tabs a {
  padding: 8px 16px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--fg); }
.tabs a.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }

/* ============================================================
   Drawer
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  display: none;
  z-index: 50;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 100vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 51;
  transform: translateX(100%);
  transition: transform .2s ease-out;
}
.drawer.open { display: flex; transform: translateX(0); }
.drawer .drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer .drawer-header h3 { margin: 0; font-size: 15px; }
.drawer .drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer .drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  display: none;
  z-index: 60;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 480px; max-width: 92vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.modal .modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal .modal-header h3 { margin: 0; font-size: 15px; }
.modal .modal-body { padding: 20px; overflow-y: auto; }
.modal .modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 70;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-500);
  padding: 12px 16px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  min-width: 260px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* ============================================================
   Empty + helpers
   ============================================================ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-subtle);
  font-size: 14px;
}
.empty.lg { padding: 100px 20px; }
.empty .icon { font-size: 32px; margin-bottom: 12px; }
.empty h4 { margin: 0 0 4px; color: var(--fg); font-size: 16px; }
.muted { color: var(--fg-muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

/* ============================================================
   Auth shell (login / register)
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.auth-shell .left {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500) 60%, #0f5e85);
  color: #fff;
  display: flex; flex-direction: column;
  padding: 64px;
  justify-content: space-between;
}
.auth-shell .left .brand { font-weight: 700; font-size: 22px; display: flex; align-items: center; gap: 4px; }
.auth-shell .left .brand img { height: 36px; width: auto; filter: brightness(0) invert(1); }
.auth-shell .left .brand .suffix { color: rgba(255,255,255,.85); font-weight: 700; font-size: 18px; letter-spacing: .3px; align-self: flex-end; padding-bottom: 6px; }
.auth-shell .left { position: relative; overflow: hidden; }
.auth-shell .left h1 { font-size: 32px; line-height: 1.2; margin: 0 0 16px; max-width: 460px; }
.auth-shell .left p { font-size: 15px; line-height: 1.5; opacity: .85; max-width: 480px; }
.auth-shell .right { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { margin: 0 0 8px; font-size: 22px; }
.auth-card .sub { color: var(--fg-muted); margin-bottom: 28px; }

@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-shell .left { display: none; }
}

/* ============================================================
   Inbox 3-col
   ============================================================ */
.inbox-grid {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  height: 100%;
  background: var(--surface);
}
.inbox-col { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inbox-col:last-child { border-right: 0; }

.inbox-filters { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--fg-muted);
  border: 1px solid transparent;
}
.chip:hover { background: var(--border); }
.chip.active { background: var(--brand-orange-50); color: var(--brand-orange); border-color: var(--brand-orange-50); }

.conv-list { overflow-y: auto; flex: 1; }
.conv-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 10px; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--brand-50); }
.conv-item .conv-body { flex: 1; min-width: 0; }
.conv-item .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-item .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .time { font-size: 11px; color: var(--fg-subtle); flex-shrink: 0; }
.conv-item .preview { font-size: 12.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-item .meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.chat-header .who { display: flex; align-items: center; gap: 10px; }
.chat-header .who .name { font-weight: 600; font-size: 14.5px; }
.chat-header .who .phone { color: var(--fg-muted); font-size: 12px; }
.chat-actions { display: flex; gap: 6px; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; background: var(--surface-2); }
.msg-row { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 8px; }
.msg-row.out { align-items: flex-end; }
.msg { max-width: 70%; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; }
.msg.inbound { background: #fff; border: 1px solid var(--border); }
.msg.outbound { background: var(--brand-500); color: #fff; }
.msg.internal { background: var(--warning-bg); border: 1px dashed var(--warning); }
.msg-time { font-size: 10.5px; color: var(--fg-subtle); margin-top: 2px; }
.chat-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-footer textarea { width: 100%; resize: none; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13.5px; min-height: 56px; font-family: inherit; }

/* Composer de resposta por e-mail */
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--fg);
}
.form-control:focus { outline: 2px solid var(--brand-500); outline-offset: 0; border-color: var(--brand-500); }
.form-control::placeholder { color: var(--fg-subtle); }
textarea.form-control { resize: vertical; min-height: 90px; }
.email-compose .reply-as { font-size: 12px; margin-bottom: 8px; color: var(--fg-subtle); }
.email-compose .compose-row { display: flex; gap: 8px; margin-bottom: 8px; }
.email-compose .compose-row .form-control { flex: 1; min-width: 0; }
.file-field {
  display: flex; align-items: center; gap: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--fg-muted);
  background: var(--surface-2);
  cursor: pointer;
}
.file-field input[type=file] { flex: 1; min-width: 0; font-size: 12px; color: var(--fg-muted); font-family: inherit; }
.file-field .hint { color: var(--fg-subtle); font-size: 11px; white-space: nowrap; flex-shrink: 0; }

/* ──────────────────────────────────────────────────────────────
   MEDIA BUBBLES (estilo WhatsApp)
   ────────────────────────────────────────────────────────────── */
.msg.has-media { padding: 4px; max-width: 320px; }
.msg.has-media.outbound { background: #d9fdd3; color: #111; border: 1px solid #c5f0bc; }
.msg.has-media.inbound { background: #fff; }
.msg-media-image { display: block; max-width: 100%; max-height: 340px; border-radius: 8px; cursor: zoom-in; object-fit: cover; }
.msg-media-caption { padding: 6px 8px 4px; font-size: 13px; line-height: 1.35; word-wrap: break-word; white-space: pre-wrap; }
.msg-media-video {
  display: block; max-width: 100%; max-height: 340px; border-radius: 8px;
  background: #000;
}

.msg-media-audio {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  min-width: 220px;
}
.msg-media-audio .play-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--brand-500); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.msg-media-audio.outbound .play-btn { background: #25d366; }
.msg-media-audio .audio-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msg-media-audio .audio-bar {
  height: 4px; background: rgba(0,0,0,.08); border-radius: 2px; position: relative; overflow: hidden;
}
.msg-media-audio .audio-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-500); width: 0%; transition: width .1s; }
.msg-media-audio.outbound .audio-bar-fill { background: #128c7e; }
.msg-media-audio .audio-time { font-size: 11px; color: var(--fg-muted); }
.msg-media-audio audio { display: none; }

.msg-media-document {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  min-width: 240px;
  background: rgba(0,0,0,.03);
  border-radius: 8px;
  margin: 4px;
}
.msg-media-document .doc-icon {
  width: 40px; height: 48px;
  background: var(--brand-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.msg.has-media.outbound .msg-media-document { background: rgba(0,0,0,.06); }
.msg-media-document .doc-info { flex: 1; min-width: 0; }
.msg-media-document .doc-name { font-weight: 600; font-size: 13px; word-break: break-word; }
.msg-media-document .doc-meta { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }
.msg-media-document .doc-download {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.05);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg); text-decoration: none;
  font-size: 16px; flex-shrink: 0;
}
.msg-media-document .doc-download:hover { background: rgba(0,0,0,.1); }

/* ──────────────────────────────────────────────────────────────
   COMPOSER com attachment + drag-drop
   ────────────────────────────────────────────────────────────── */
.chat-footer { position: relative; }
.composer-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.composer-toolbar .attach-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--fg-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.composer-toolbar .attach-btn:hover { background: var(--border); color: var(--fg); }
.composer-toolbar .send-btn-icon {
  margin-left: auto;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--brand-500); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.composer-toolbar .send-btn-icon:disabled { opacity: .5; cursor: not-allowed; }
.composer-toolbar .hint { font-size: 11px; color: var(--fg-subtle); }

.attach-menu {
  position: absolute;
  bottom: 100%; left: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  margin-bottom: 6px;
  z-index: 40;
}
.attach-menu.open { display: flex; gap: 4px; }
.attach-menu button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px;
  border: 0; background: transparent;
  border-radius: 8px; cursor: pointer;
  font-size: 11px; color: var(--fg-muted);
}
.attach-menu button:hover { background: var(--surface-2); color: var(--fg); }
.attach-menu button .ico { font-size: 22px; }

.attach-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
}
.attach-preview img, .attach-preview video {
  max-height: 64px; max-width: 64px; border-radius: 6px; object-fit: cover;
}
.attach-preview .icon-tile {
  width: 48px; height: 48px; border-radius: 8px;
  background: var(--brand-500); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.attach-preview .info { flex: 1; min-width: 0; }
.attach-preview .name { font-weight: 600; font-size: 13px; word-break: break-word; }
.attach-preview .meta { font-size: 11px; color: var(--fg-muted); }
.attach-preview .remove {
  background: transparent; border: 0; cursor: pointer;
  color: var(--fg-muted); font-size: 18px; padding: 4px 8px;
}
.attach-preview .remove:hover { color: var(--danger); }

.chat-body.drag-over { outline: 3px dashed var(--brand-500); outline-offset: -10px; background: var(--brand-50) !important; }
.chat-body.drag-over::after {
  content: "📎 Solte para anexar"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: var(--brand-500);
  pointer-events: none;
}

.upload-progress {
  position: absolute; left: 0; top: -2px; height: 2px;
  background: var(--brand-500); width: 0%; transition: width .2s;
}

/* ──────────────────────────────────────────────────────────────
   LIGHTBOX
   ────────────────────────────────────────────────────────────── */
.media-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
.media-lightbox.open { display: flex; }
.media-lightbox img, .media-lightbox video {
  max-width: 90vw; max-height: 90vh;
  border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.media-lightbox .close-btn {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff; border: 0;
  font-size: 22px; cursor: pointer;
}
.media-lightbox .close-btn:hover { background: rgba(255,255,255,.2); }
.media-lightbox .download-btn {
  position: absolute; bottom: 20px; right: 20px;
  padding: 10px 18px;
  background: rgba(255,255,255,.15); color: #fff;
  border-radius: 8px; text-decoration: none;
  font-size: 14px; font-weight: 600;
}
.media-lightbox .download-btn:hover { background: rgba(255,255,255,.25); }

.contact-panel { padding: 0; overflow-y: auto; flex: 1; }
.panel-block { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-block h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; color: var(--fg-muted); letter-spacing: .5px; }
.panel-block .kv { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; gap: 12px; }
.panel-block .kv .k { color: var(--fg-muted); }
.panel-block .kv .v { font-weight: 500; text-align: right; }

.panel-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; gap: 8px; font-size: 13px;
}
.panel-row .k { color: var(--fg-muted); font-size: 12.5px; }
.inline-select {
  padding: 4px 24px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat right 8px center;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  color: var(--fg);
}
.inline-select:hover { background-color: var(--border); }
.inline-select:focus { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.inline-select.priority-LOW { color: #16a34a; border-color: #d1fae5; background-color: #ecfdf5; }
.inline-select.priority-MEDIUM { color: #d97706; border-color: #fde68a; background-color: #fffbeb; }
.inline-select.priority-HIGH { color: #dc2626; border-color: #fecaca; background-color: #fef2f2; }

.urgent-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  transition: all .15s;
}
.urgent-toggle:hover { background: var(--border); }
.urgent-toggle.on {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.tag-chip-editable {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
}
.tag-chip-editable .x {
  width: 16px; height: 16px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: .7;
  font-size: 12px;
  line-height: 1;
}
.tag-chip-editable .x:hover { opacity: 1; background: rgba(0,0,0,.1); }
.tag-add-btn {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--fg-muted);
  border: 1px dashed var(--border-strong);
  cursor: pointer;
}
.tag-add-btn:hover { background: var(--border); color: var(--fg); }

.tag-popover {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 40;
  padding: 4px 0;
}
.tag-popover .option {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.tag-popover .option:hover { background: var(--surface-2); }
.tag-popover .option .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tag-popover .empty { padding: 12px; text-align: center; font-size: 12px; color: var(--fg-subtle); }

/* Transfer banner & notification */
.transfer-banner {
  background: var(--info-bg);
  border: 1px solid var(--info);
  border-left: 4px solid var(--info);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.transfer-banner .info { flex: 1; min-width: 0; }
.transfer-banner .info .title { font-weight: 700; font-size: 13.5px; color: var(--info); }
.transfer-banner .info .note { font-size: 12.5px; color: var(--fg); margin-top: 2px; }
.transfer-banner .actions { display: flex; gap: 6px; flex-shrink: 0; }

.transfer-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 80;
  animation: slideIn .25s ease-out;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.transfer-toast .head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: var(--info); margin-bottom: 6px; }
.transfer-toast .body { font-size: 13px; color: var(--fg); margin-bottom: 10px; line-height: 1.4; }
.transfer-toast .actions { display: flex; gap: 8px; }
.transfer-toast .actions .btn { flex: 1; }

/* More actions dropdown */
.more-wrap { position: relative; }
.more-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 220px;
  z-index: 30;
  padding: 4px 0;
}
.more-menu.open { display: block; }
.more-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 14px;
  border: 0; background: transparent;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  color: var(--fg);
}
.more-item:hover { background: var(--surface-2); }
.more-item.danger { color: var(--danger); }
.more-item.danger:hover { background: var(--danger-bg); }

/* Audit log */
.audit-list { display: flex; flex-direction: column; gap: 0; }
.audit-item {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.audit-item:last-child { border-bottom: 0; }
.audit-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-500);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.audit-icon.success { background: var(--success-bg); color: var(--success); }
.audit-icon.warning { background: var(--warning-bg); color: var(--warning); }
.audit-icon.danger { background: var(--danger-bg); color: var(--danger); }
.audit-body { flex: 1; min-width: 0; }
.audit-body .who { font-weight: 600; color: var(--fg); }
.audit-body .desc { color: var(--fg-muted); font-size: 12px; margin-top: 2px; word-break: break-word; }
.audit-body .time { font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }

.panel-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.panel-tabs a {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.panel-tabs a:hover { color: var(--fg); }
.panel-tabs a.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }

/* Dashboard KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.kpi-card .label { font-size: 12px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi-card .value { font-size: 30px; font-weight: 700; color: var(--fg); margin: 6px 0 4px; line-height: 1; }
.kpi-card .meta { font-size: 12px; color: var(--fg-subtle); }
.kpi-card.success { border-left: 3px solid var(--success); }
.kpi-card.warning { border-left: 3px solid var(--warning); }
.kpi-card.danger { border-left: 3px solid var(--danger); }
.kpi-card.brand { border-left: 3px solid var(--brand-500); }
.kpi-card.info { border-left: 3px solid var(--info); }

.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-grid.equal { grid-template-columns: 1fr 1fr; }
@media (max-width: 980px) { .chart-grid, .chart-grid.equal { grid-template-columns: 1fr; } }

.chart-wrap { position: relative; height: 280px; }
.chart-wrap.lg { height: 340px; }

.period-switcher { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; border: 1px solid var(--border); }
.period-switcher button {
  border: 0; background: transparent;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer; border-radius: 6px;
}
.period-switcher button.active { background: var(--surface); color: var(--brand-500); box-shadow: var(--shadow-sm); }

/* Canned popover */
.canned-popover {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 60;
  padding: 4px 0;
}
.canned-popover .head {
  padding: 6px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--fg-subtle);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.canned-popover .option {
  display: flex; gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.canned-popover .option:last-child { border-bottom: 0; }
.canned-popover .option:hover, .canned-popover .option.selected { background: var(--brand-50); }
.canned-popover .option .shortcut {
  font-family: ui-monospace, monospace;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--brand-500);
  font-weight: 700;
  flex-shrink: 0;
  align-self: flex-start;
}
.canned-popover .option .body { min-width: 0; flex: 1; }
.canned-popover .option .title { font-weight: 600; }
.canned-popover .option .preview { color: var(--fg-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.canned-popover .empty { padding: 16px; text-align: center; font-size: 12px; color: var(--fg-subtle); }

/* Notification toggle */
.notif-toggle {
  position: relative;
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-2);
  cursor: pointer;
  color: var(--fg-muted);
}
.notif-toggle:hover { background: var(--border); }
.notif-toggle.on { background: var(--brand-50); color: var(--brand-500); border-color: var(--brand-50); }
.notif-toggle.denied { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bg); }
.notif-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg-subtle);
}
.notif-toggle.on .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.notif-toggle.denied .dot { background: var(--danger); }

.notif-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  z-index: 80;
  max-width: 540px;
}
.notif-banner .icon { font-size: 18px; }
.notif-banner .body { flex: 1; }
.notif-banner .actions { display: flex; gap: 6px; }

/* ============================================================
   Page header
   ============================================================ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-header .sub { color: var(--fg-muted); margin-top: 4px; font-size: 13px; }
.page-header .actions { display: flex; gap: 8px; }
.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters-bar select, .filters-bar input {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border-strong); font-size: 13px; background: #fff; min-width: 160px;
}

/* ============================================================
   C3 — Presence indicator (sidebar/list)
   ============================================================ */
.presence-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#9ca3af; vertical-align:middle; margin-right:6px; box-shadow:0 0 0 2px #fff; }
.presence-dot.ONLINE { background:#22c55e; }
.presence-dot.AWAY { background:#f59e0b; }
.presence-dot.OFFLINE { background:#9ca3af; }

/* ============================================================
   C6 — Viewers banner ("Ana está respondendo agora")
   ============================================================ */
.viewers-banner {
  display:flex; align-items:center; gap:8px;
  padding:8px 14px; margin:10px 14px;
  background: linear-gradient(90deg, #fff7ed 0%, #ffedd5 100%);
  border:1px solid #fed7aa;
  border-left:4px solid #f59e0b;
  border-radius:10px;
  color:#9a3412; font-size:12.5px; font-weight:500;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.viewers-banner .ic { font-size:14px; }

/* ============================================================
   C5 — Typing indicator
   ============================================================ */
.typing-indicator {
  display:flex; align-items:center; gap:8px;
  padding:6px 14px;
  background: var(--surface-2, #f8fafc);
  border-top: 1px solid var(--border, #e5e7eb);
  color: var(--fg-muted, #6b7280);
  font-size: 12px; font-style: italic;
}
.typing-indicator .dots { display:inline-flex; gap:3px; align-items:center; }
.typing-indicator .dots span {
  width:5px; height:5px; border-radius:50%; background: var(--brand-500);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-indicator .dots span:nth-child(2) { animation-delay: .2s; }
.typing-indicator .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ============================================================
   C4 — Mention + internal note editor
   ============================================================ */
.internal-note {
  margin-bottom:8px;
  padding:10px;
  background: var(--warning-bg, #fef3c7);
  border-radius:8px;
  font-size:13px;
}
.internal-note .note-body { white-space: pre-wrap; word-wrap: break-word; }
.mention {
  background: var(--brand-50, #eef2ff);
  color: var(--brand-500);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12.5px;
}
.note-editor textarea {
  width:100%;
  padding:8px 10px;
  border:1px solid var(--border-strong, #d1d5db);
  border-radius:8px;
  font-size:13px;
  resize:vertical;
  min-height:60px;
  font-family: inherit;
}
.note-editor textarea:focus { outline: 2px solid var(--brand-500); outline-offset: -1px; }

/* ============================================================
   C2 — Macros
   ============================================================ */
.macro-action-row {
  display:grid;
  grid-template-columns:160px 1fr 32px;
  gap:8px;
  margin-bottom:8px;
  align-items:center;
}
.macro-action-row select, .macro-action-row input, .macro-action-row textarea {
  padding:8px 10px;
  border:1px solid var(--border-strong, #d1d5db);
  border-radius:6px;
  font-size:13px;
  width:100%;
}
.macro-bar { display:flex; gap:6px; flex-wrap:wrap; padding:0 14px 8px; }
.macro-chip {
  display:inline-flex; align-items:center; gap:6px;
  padding:5px 10px; border-radius:14px;
  background: var(--brand-50); color: var(--brand-500);
  font-size:12px; font-weight:600; cursor:pointer;
  border: 1px solid transparent; transition: all .15s;
}
.macro-chip:hover { background: var(--brand-500); color:#fff; }

.assign-banner {
  display:flex; align-items:center; gap:8px;
  padding:8px 14px; margin:10px 14px;
  background:#f1f5f9;
  border:1px solid #cbd5e1;
  border-left:4px solid #64748b;
  border-radius:10px;
  color:#334155; font-size:12.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.assign-banner .ic { font-size:14px; }

/* ============================================================
   mabecoModal — confirm/prompt customizado (substitui prompt/confirm nativos)
   ============================================================ */
.m-modal-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease;
  backdrop-filter: blur(2px);
}
.m-modal-backdrop.open { opacity: 1; }
.m-modal-backdrop.closing { opacity: 0; }
.m-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 440px;
  padding: 28px 24px 20px;
  text-align: center;
  transform: scale(.94);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.m-modal-backdrop.open .m-modal { transform: scale(1); }
.m-modal-icon {
  font-size: 42px; line-height: 1;
  margin-bottom: 12px;
  animation: mModalPop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mModalPop { 0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.m-modal-title { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.m-modal-msg { font-size: 13.5px; color: #475569; line-height: 1.5; margin-bottom: 16px; }
.m-modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 16px;
  transition: border-color .15s;
}
.m-modal-input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(0,48,73,.15); }
.m-modal-input-err { border-color: #dc2626; animation: mShake .25s; }
@keyframes mShake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }
.m-modal-actions { display: flex; gap: 8px; justify-content: center; }
.m-btn {
  padding: 10px 22px;
  border-radius: 10px;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.m-btn-ghost { background: #f1f5f9; color: #475569; }
.m-btn-ghost:hover { background: #e2e8f0; }
.m-btn-primary { background: var(--brand-500); color: #fff; }
.m-btn-primary:hover { background: #1f4ecf; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(41,98,255,.3); }
.m-btn-danger { background: #dc2626; color: #fff; }
.m-btn-danger:hover { background: #b91c1c; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(220,38,38,.3); }
.m-modal.m-danger .m-modal-title { color: #dc2626; }

/* Ajuste de bolha pra mensagens muito curtas não ficarem desproporcionais */
.msg { min-width: 60px; word-wrap: break-word; }
.msg.outbound { min-width: 80px; }

/* ===== AI Suggestions ===== */
.ai-suggestions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--brand-50);
  align-items: flex-start;
}
.ai-suggestion-chip {
  background: var(--surface);
  border: 1px solid var(--brand-500);
  color: var(--brand-500);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  max-width: 100%;
  white-space: normal;
  line-height: 1.4;
}
.ai-suggestion-chip:hover {
  background: var(--brand-500);
  color: #fff;
}

/* ===== Briefing IA ===== */
.briefing-block { border-left: 3px solid var(--brand-500); }
.briefing-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.briefing-stats span {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 7px;
}

/* ===== Pattern Alerts (dashboard) ===== */
.pattern-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.pattern-item:last-child { border-bottom: 0; }
.pattern-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.pattern-theme { font-weight: 600; font-size: 13.5px; flex: 1; }
.pattern-count { font-size: 12px; font-weight: 700; background: var(--surface-2); border-radius: 10px; padding: 1px 8px; }
.pattern-urgency { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.pattern-examples { font-size: 12px; color: var(--fg-muted); font-style: italic; line-height: 1.5; }

/* ===== Knowledge Base ===== */
.toggle-label { display:flex; align-items:center; gap:10px; cursor:pointer; font-weight:500; }
.toggle-label input[type=checkbox] { width:18px; height:18px; cursor:pointer; accent-color: var(--brand-500); }
.help-text { font-size:12px; color:var(--fg-muted); margin-top:4px; }

/* ============================================================
   Painel admin interno (MABECO) — shell separado do app de clientes
   ============================================================ */
.admin-nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.admin-nav-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: var(--topbar-h); display: flex; align-items: center; gap: 28px; }
.admin-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); }
.admin-brand img { height: 24px; }
.admin-nav-links { display: flex; gap: 4px; flex: 1; }
.admin-nav-links a { padding: 8px 14px; border-radius: var(--r-md); color: var(--fg-muted); font-size: 13.5px; font-weight: 500; }
.admin-nav-links a:hover { background: var(--surface-2); color: var(--fg); }
.admin-nav-links a.active { background: var(--brand-50); color: var(--brand-500); }
.admin-nav-user { display: flex; align-items: center; gap: 12px; }
.admin-main { max-width: 1280px; margin: 0 auto; padding: 24px; }

