/* ============================================================
   evoChat Painel - CSS portado do legado evo-painel (main.css +
   estilos de Sidebar/Header/Login/VerifyEmail). Fidelidade 1:1.
   ============================================================ */

:root {
  /* Cores base do tema claro */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-light: #64748b;
  --border-color: #e2e8f0;
  --font-sans: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  /* Cores de status (fixas) */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  /* Accent Colors (EvoChat) */
  --primary-color: #0C668A;
  --primary-dark: #09546d;
  --primary-light: #3f8eac;

  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  /* Sidebar settings */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --header-height: 64px;

  /* UI components */
  --ui-control-height: 2.75rem;
  --ui-option-row-height: 2.45rem;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #0b1224;
  --bg-hover: rgba(148, 163, 184, 0.14);
  --text-primary: #f8fafc;
  --text-secondary: #a7b6cd;
  --text-light: #7f90ab;
  --border-color: rgba(148, 163, 184, 0.34);
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #22d3ee;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-strong: rgba(15, 23, 42, 0.46);
  --glass-input: rgba(15, 23, 42, 0.42);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[x-cloak] { display: none !important; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
  font-size: 15px;
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

.scroll-container {
  height: 100%;
  overflow-y: auto;
  padding-bottom: 2rem;
}

#app {
  height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--text-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Utilities */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn,
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary,
.ui-btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover,
.ui-btn-primary:hover { background-color: var(--primary-dark); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35); }
.btn-secondary,
.ui-btn-secondary { background-color: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover,
.ui-btn-secondary:hover { background-color: var(--bg-hover); }
.btn-success,
.ui-btn-success { background-color: var(--success-color); color: white; }
.btn-danger,
.ui-btn-danger { background-color: var(--danger-color); color: white; }

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .card {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 14px 34px rgba(2, 6, 23, 0.45);
}

.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 700; border-radius: 9999px; }
.badge-success { background-color: #dcfce7; color: #166534; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-info { background-color: #dbeafe; color: #1e3a8a; }

[data-theme="dark"] .badge-success { background-color: rgba(16, 185, 129, 0.25); color: #86efac; }
[data-theme="dark"] .badge-warning { background-color: rgba(245, 158, 11, 0.25); color: #fcd34d; }
[data-theme="dark"] .badge-danger { background-color: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .badge-info { background-color: rgba(59, 130, 246, 0.25); color: #93c5fd; }

.input,
.ui-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s;
  font-family: inherit;
}

[data-theme="dark"] .input,
[data-theme="dark"] .ui-input,
[data-theme="dark"] .textarea,
[data-theme="dark"] .menu-toggle-btn,
[data-theme="dark"] .toggle-btn,
[data-theme="dark"] .theme-mode-toggle {
  background: var(--glass-input);
  border-color: var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

select.input,
select.ui-input {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
}

[data-theme="dark"] select.input,
[data-theme="dark"] select.ui-input {
  background-color: var(--bg-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.page-header {
  margin-bottom: 2rem;
  padding-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  gap: 1rem;
  width: 100%;
}

.header-main { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.header-title-row { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; margin: 0; line-height: 1.2; }
.page-header p, .page-header .text-muted { margin: 0; font-size: 0.875rem; line-height: 1.5; color: var(--text-secondary); }
.header-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.25rem; }
.section-header { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.75rem; }

.users-page, .departments-page, .units-page, .reports-page, .dashboard-page {
  height: 100%;
  overflow-y: auto;
  padding-right: 0.5rem;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

.input:focus,
.ui-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }

.field-required-label {
  display: block;
  margin: 0.1rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--danger-color);
}

.field-required-label-placeholder {
  visibility: hidden;
}

.form-group.has-error .input,
.form-group.has-error .ui-input {
  border-color: var(--danger-color) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

.form-group.has-error .ui-select-trigger {
  border-color: var(--danger-color) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

.form-group.has-error .multi-select-shell {
  border-color: var(--danger-color) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

.form-group.has-error .multi-select-search {
  border-color: var(--danger-color) !important;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible,
.toggle-btn:focus-visible,
.avatar:focus-visible,
.dropdown-item:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.text-muted { color: var(--text-secondary); }
.text-small { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-light { color: var(--text-light); }

.spinner { border: 3px solid var(--bg-secondary); border-top-color: var(--primary-color); border-radius: 50%; width: 24px; height: 24px; animation: spin 0.8s linear infinite; }
.spinner-sm { border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; width: 16px; height: 16px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ============================================================
   LAYOUT (MainLayout.vue)
   ============================================================ */
.main-layout {
  display: flex;
  height: 100vh;
  background-color: var(--bg-secondary);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .main-layout::before,
[data-theme="dark"] .main-layout::after,
[data-theme="dark"] .content-wrapper::before {
  content: "";
  position: absolute;
  border-radius: 9999px;
  pointer-events: none;
}

[data-theme="dark"] .main-layout::before {
  width: 24rem;
  height: 24rem;
  top: -7rem;
  left: -7rem;
  background: rgba(79, 70, 229, 0.3);
  filter: blur(120px);
}

[data-theme="dark"] .main-layout::after {
  width: 24rem;
  height: 24rem;
  right: -7rem;
  bottom: -7rem;
  background: rgba(192, 38, 211, 0.2);
  filter: blur(120px);
}

[data-theme="dark"] .content-wrapper::before {
  width: 20rem;
  height: 20rem;
  right: -4rem;
  top: -5rem;
  background: rgba(6, 182, 212, 0.2);
  filter: blur(100px);
  z-index: 0;
}

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: hidden;
}

.content-wrapper.collapsed-margin { margin-left: var(--sidebar-collapsed-width); }
.content-wrapper.no-margin { margin-left: 0; }

.main-content {
  flex: 1;
  min-height: 0;
  padding: 2rem;
  overflow-y: auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.main-content.no-padding { padding: 0; }

@media (max-width: 768px) {
  .content-wrapper, .content-wrapper.collapsed-margin { margin-left: 0; }
  .main-content { padding: 1rem; }
}

/* ============================================================
   SIDEBAR (Sidebar.vue)
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}

[data-theme="dark"] .sidebar {
  background: var(--glass-bg-strong);
  border-right-color: var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-right: 1px solid var(--bg-primary);
  margin-right: -1px;
  position: relative;
  z-index: 10;
}

.logo-container { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; }
.logo-img { height: 32px; width: 32px; object-fit: contain; flex-shrink: 0; }
.brand-info { display: flex; flex-direction: column; justify-content: center; }
.logo-text { font-size: 1.125rem; line-height: 1.1; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.version-text { font-size: 0.75rem; color: var(--text-light); font-weight: 500; }

.toggle-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  border-right: 1px solid var(--bg-primary);
  margin-right: -1px;
}

.toggle-container:hover { background-color: var(--bg-hover); }

[data-theme="dark"] .toggle-container,
[data-theme="dark"] .sidebar-header {
  border-right-color: transparent;
}

.toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toggle-btn:hover { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.toggle-text { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.sidebar.collapsed .toggle-container { padding-left: 1.25rem; justify-content: flex-start; }

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  padding-left: 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-item:hover { background-color: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background-color: var(--primary-color); color: white; box-shadow: 0 4px 12px rgba(12, 102, 138, 0.2); }
[data-theme="dark"] .nav-item:hover { background: rgba(148, 163, 184, 0.12); }
[data-theme="dark"] .nav-item.active { box-shadow: 0 8px 22px rgba(79, 70, 229, 0.36); }
.nav-icon { flex-shrink: 0; width: 22px; display: flex; justify-content: center; }
.nav-text { font-size: 0.875rem; }
.sidebar.collapsed .nav-item { justify-content: flex-start; padding-left: 1.25rem; }
.sidebar.collapsed .nav-icon { margin: 0; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 999;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  }
}

/* ============================================================
   HEADER (Header.vue)
   ============================================================ */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
}

[data-theme="dark"] .header,
[data-theme="dark"] .user-dropdown {
  background: var(--glass-bg-strong);
  border-color: var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-content { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.header-left { display: flex; align-items: center; }

.menu-toggle-btn {
  display: none;
  width: 36px;
  height: 36px;
  margin-right: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.company-info { display: flex; align-items: center; gap: 1rem; }
.title-block { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.company-logo { height: 32px; width: auto; object-fit: contain; }
.page-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

@media (max-width: 768px) {
  .menu-toggle-btn { display: inline-flex; }
  .company-logo { display: none; }
  .page-title { font-size: 1rem; }
  .header { padding: 0.75rem 1rem; }
  .user-info-header { display: none; }
}

.ws-health-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.675rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}

.ws-health-badge.status-ok { color: #065f46; background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.35); }
.ws-health-badge.status-warning { color: #b45309; background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.35); }
.ws-health-badge.status-critical { color: #b91c1c; background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.35); }
.ws-health-badge.status-offline { color: #374151; background: #f3f4f6; border-color: #d1d5db; }

[data-theme="dark"] .ws-health-badge.status-ok {
  color: #86efac;
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.45);
}

[data-theme="dark"] .ws-health-badge.status-warning {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.45);
}

[data-theme="dark"] .ws-health-badge.status-critical {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.24);
  border-color: rgba(239, 68, 68, 0.45);
}

[data-theme="dark"] .ws-health-badge.status-offline {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(148, 163, 184, 0.45);
}

.header-right { display: flex; align-items: center; gap: 1.25rem; }
.user-info-header { display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.2; }
.user-name-header { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.user-email-header { font-size: 0.75rem; }

.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.theme-toggle:hover { background: var(--bg-hover); }
.user-menu-container { position: relative; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  border: 2px solid transparent;
  padding: 0;
  font-family: inherit;
}

.avatar:hover, .avatar.active { box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--primary-color); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 220px;
  padding: 0.5rem;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-header { padding: 0.75rem 1rem; display: flex; flex-direction: column; max-width: 100%; overflow: hidden; }
.user-full-name { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 0.5rem 0; }
.dropdown-section { padding: 0.5rem 1rem; }
.dropdown-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); font-weight: 700; margin-bottom: 0.5rem; }
.theme-controls { display: flex; flex-direction: column; gap: 0.75rem; }

.theme-mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.theme-mode-toggle:hover { background: var(--bg-hover); }
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.4rem; }

.color-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.color-dot:hover { transform: scale(1.15); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  text-align: left;
  text-decoration: none;
}

.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.logout { color: var(--danger-color); }
.dropdown-item.logout:hover { background: rgba(239, 68, 68, 0.1); }

[data-theme="dark"] .dropdown-item:hover { background: rgba(148, 163, 184, 0.12); }

/* ============================================================
   LOGIN (LoginView.vue)
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  background-image: url('https://webpresto.com.br/images/evochat/bg_login.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.login-sidebar {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-right: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 2.5rem 3.5rem;
  position: relative;
  z-index: 2;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
}

.login-card { width: 100%; display: flex; flex-direction: column; gap: 1.5rem; }
.login-header { text-align: center; margin-bottom: 0.5rem; }
.login-logo { height: 80px; width: auto; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3)); }
.login-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.75rem; }
.form-group label { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.025em; }
.login-page .form-group label { color: #f8fafc; }

.dark-input { background: transparent; border: 1px solid rgba(255, 255, 255, 0.4); color: white; padding: 0.875rem 1.25rem; font-size: 1rem; }
.dark-input::placeholder { color: rgba(255, 255, 255, 0.6); }
.dark-input:focus { background: rgba(255, 255, 255, 0.05); border-color: #0C668A; box-shadow: 0 0 0 4px rgba(12, 102, 138, 0.2); }

.btn-block {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1rem;
  background-color: #0C668A;
  border: none;
  box-shadow: 0 4px 15px rgba(12, 102, 138, 0.3);
  font-family: var(--font-sans);
}

.btn-block:hover { background-color: #09546d; }

.password-input-wrapper { position: relative; display: flex; align-items: center; }
.password-toggle {
  position: absolute;
  right: 1.25rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.2s;
}
.password-toggle:hover { color: white; }

.forgot-password-container { text-align: right; margin-top: -0.5rem; }
.forgot-password-link { color: #94a3b8; font-size: 0.8rem; text-decoration: none; transition: color 0.2s; }
.forgot-password-link:hover { color: white; }
.forgot-password-note { color: #cbd5e1; font-size: 0.8rem; line-height: 1.4; display: inline-block; }

.error-message {
  padding: 1rem;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.login-footer { margin-top: 2rem; text-align: center; opacity: 0.7; }

.forgot-header { margin-bottom: 0.5rem; }
.forgot-title { font-size: 1.25rem; font-weight: 700; color: #f8fafc; margin: 0 0 0.5rem 0; }
.forgot-subtitle { font-size: 0.85rem; color: #94a3b8; margin: 0; line-height: 1.5; }
.forgot-subtitle strong { color: #cbd5e1; }
.code-input { letter-spacing: 0.5em; font-size: 1.25rem; text-align: center; }
.back-link-container { text-align: center; margin-top: 0.25rem; }
.back-link { color: var(--text-secondary); font-size: 0.82rem; text-decoration: none; transition: color 0.2s; }
.back-link:hover { color: var(--primary-color); }
.success-container { text-align: center; padding: 1.5rem 0; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.success-icon { font-size: 2.5rem; }

@media (max-width: 640px) {
  .login-sidebar { max-width: 100%; padding: 2.5rem 1.5rem; background: rgba(15, 23, 42, 0.9); }
  .login-logo { height: 60px; }
}

/* ============================================================
   VERIFY EMAIL (VerifyEmailView.vue)
   ============================================================ */
.verify-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary, #0f172a);
  padding: 1rem;
}

.verify-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.verify-logo { text-align: center; margin-bottom: 2rem; }
.verify-logo .logo-text {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #0C668A, #09546d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.verify-form h2, .verify-state h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
  margin: 0 0 0.4rem;
  text-align: center;
}

.subtitle { font-size: 0.9rem; color: var(--text-secondary, #94a3b8); text-align: center; margin-bottom: 1.5rem; }
.verify-state { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem 0; text-align: center; }
.verify-state p { color: var(--text-secondary, #94a3b8); font-size: 0.9rem; }
.text-green { color: #10b981; }
.text-red { color: #ef4444; }

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.field { margin-bottom: 1.2rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary, #94a3b8); margin-bottom: 0.4rem; }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 0.9rem;
  background: var(--bg-tertiary, #0f172a);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  color: var(--text-primary, #f1f5f9);
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.input-wrap input:focus { outline: none; border-color: var(--primary-color); }

.toggle-eye {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, #94a3b8);
  padding: 0;
  display: flex;
  align-items: center;
}

.verify-card .btn-primary {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, #0C668A, #09546d);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.2s;
}
.verify-card .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.verify-card .btn-secondary {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  background: var(--bg-tertiary, #0f172a);
  border: 1px solid var(--border-color, #334155);
  color: var(--text-primary, #f1f5f9);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
.verify-card .btn-secondary:hover { border-color: var(--primary-color); }
.spin { animation: spin 1s linear infinite; }

/* ===== Fase 2: Configuracoes / Unidades / Departamentos ===== */
.settings-content { display: flex; flex-direction: column; gap: 1.5rem; }
.settings-card { padding: 2rem; }
.settings-card h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
.mb-1-5 { margin-bottom: 1.5rem; }

.textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
}
.help-text { margin-top: 0.35rem; }
.checkbox-label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.checkbox { width: 1rem; height: 1rem; }
.department-flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
.department-flow-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 58px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.25;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.department-flow-option:hover { border-color: var(--primary-color); background: var(--bg-hover); }
.department-flow-option input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.department-flow-check {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 1.1rem;
  border: 2px solid var(--text-light);
  border-radius: 0.25rem;
  background: var(--bg-primary);
}
.department-flow-label { min-width: 0; overflow-wrap: anywhere; }
.department-flow-option:has(input[type="checkbox"]:checked) {
  border-color: var(--primary-color);
  background: rgba(34, 211, 238, 0.16);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}
.department-flow-option:has(input[type="checkbox"]:checked) .department-flow-check {
  border-color: var(--primary-color);
  background: var(--primary-color);
  box-shadow: inset 0 0 0 3px var(--bg-secondary);
}
@media (max-width: 900px) { .department-flow-grid { grid-template-columns: 1fr; } }
.time-inputs { display: flex; gap: 1rem; flex-wrap: wrap; }
.time-inputs .form-group { flex: 1; min-width: 140px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.multi-select-shell {
  position: relative;
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  padding: 0.65rem;
}

/* Modo dropdown: botao compacto; lista abre em overlay. */
.multi-select--dropdown {
  padding: 0;
  border: 0;
  background: transparent;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.multi-select-trigger:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
}

.multi-select-shell.is-open .multi-select-trigger {
  border-color: var(--primary-color);
}

.multi-select-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

.multi-select-shell.is-open .multi-select-chevron {
  transform: rotate(180deg);
}

.multi-select-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 50;
  padding: 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.multi-select-shell.is-open .multi-select-dropdown {
  display: block;
}

.multi-select--dropdown .multi-select-panel {
  display: block;
  margin-top: 0.45rem;
  max-height: calc(var(--ui-option-row-height) * 5);
}

.multi-select-selected--chips-only {
  margin-top: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
}

.multi-select-selected--chips-only .multi-select-selected-chips {
  gap: 0.3rem;
}

.multi-select-search-wrap {
  position: relative;
}

.multi-select-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
}

.multi-select-search {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.65rem 0.9rem 0.65rem 2.45rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.multi-select-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(12, 102, 138, 0.15);
}

.multi-select-selected {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.08);
}

.multi-select-selected-count {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-primary);
}

.multi-select-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.multi-select-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 1.65rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
}

.multi-select-chip-more {
  color: var(--primary-light);
}

.multi-select-panel {
  margin-top: 0.65rem;
  max-height: calc(var(--ui-option-row-height) * 5);
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  display: none;
}

.multi-select-shell.is-open .multi-select-panel {
  display: block;
}

.multi-select-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s;
  color: var(--text-primary);
}

.multi-select-option + .multi-select-option {
  border-top: 1px solid var(--border-color);
}

.multi-select-option:hover {
  background-color: var(--bg-hover);
}

.multi-select-option.is-selected,
.multi-select-option:has(input[type="checkbox"]:checked) {
  background-color: rgba(99, 102, 241, 0.18);
  color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--primary-color);
}

.multi-select-option.is-selected span,
.multi-select-option:has(input[type="checkbox"]:checked) span {
  font-weight: 800;
}

.multi-select-option input[type="checkbox"] {
  margin-top: 0.15rem;
  accent-color: var(--primary-color);
}

.multi-select-option input[type="radio"] {
  margin-top: 0.15rem;
  accent-color: var(--primary-color);
}

.multi-select-empty {
  padding: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.multi-select-shell.compact {
  padding: 0.45rem;
}

.multi-select-shell.compact .multi-select-search {
  font-size: 0.82rem;
  padding: 0.5rem 0.8rem 0.5rem 2.2rem;
}

.multi-select-shell.compact .multi-select-search-icon {
  left: 0.75rem;
}

.multi-select-shell.compact .multi-select-panel {
  margin-top: 0.5rem;
  max-height: calc(var(--ui-option-row-height) * 5);
}

.ui-select-shell {
  position: relative;
  width: 100%;
}

.ui-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.ui-select-trigger {
  width: 100%;
  min-height: var(--ui-control-height);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  gap: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.ui-select-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-select-chevron {
  flex-shrink: 0;
  color: var(--text-light);
  transition: transform 0.2s;
}

.ui-select-shell.is-open .ui-select-chevron {
  transform: rotate(180deg);
}

.ui-select-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 90;
  overflow: hidden;
}

.ui-select-shell.is-open .ui-select-panel {
  display: block;
}

.ui-select-search-wrap {
  position: relative;
  padding: 0.55rem;
  border-bottom: 1px solid var(--border-color);
}

.ui-select-search {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.52rem 0.8rem 0.52rem 2.15rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.84rem;
}

.ui-select-search-icon {
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.ui-select-search:focus,
.ui-select-trigger:focus-visible {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.ui-select-options {
  max-height: calc(var(--ui-option-row-height) * 5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ui-select-option {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
}

.ui-select-option:first-child {
  border-top: 0;
}

.ui-select-option:hover {
  background: var(--bg-hover);
}

.ui-select-option.is-selected {
  color: var(--primary-light);
  background: rgba(34, 211, 238, 0.08);
}

.ui-select-empty {
  padding: 0.7rem 0.8rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

[data-theme="dark"] .ui-select-trigger,
[data-theme="dark"] .ui-select-panel,
[data-theme="dark"] .ui-select-search {
  border-color: var(--border-color);
}

[data-theme="dark"] .ui-select-trigger,
[data-theme="dark"] .ui-select-panel {
  background: var(--bg-primary);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

[data-theme="dark"] .ui-select-search {
  background: var(--bg-secondary);
}

.multi-select-shell.compact .multi-select-option {
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
}

.report-filters .multi-select-shell {
  min-width: 220px;
}

@media (max-width: 900px) {
  .report-filters .multi-select-shell {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
}

.success-message {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1rem;
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981; font-weight: 600;
  border-radius: var(--radius-md);
}
.actions { display: flex; justify-content: flex-end; gap: 0.75rem; }
.settings-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }

.empty-state { padding: 3rem 2rem; text-align: center; }
.empty-state h3 { margin: 0 0 0.5rem; }
.table-container { padding: 0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.data-table th { font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; }
.data-table tbody tr:hover { background-color: var(--bg-hover); }
.scope-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.scope-chip-list .badge { white-space: nowrap; }
.text-right { text-align: right !important; }
.unit-sigla { font-weight: 700; color: var(--primary-color); }
.unit-info { display: flex; flex-direction: column; }
.unit-name { font-weight: 600; }
.btn-sm, .ui-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.alert-error { padding: 0.85rem 1rem; background-color: rgba(239,68,68,0.12); color: #ef4444; border-radius: var(--radius-md); margin-bottom: 1rem; }

@media (max-width: 900px) {
  .table-container { overflow-x: visible; }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0.85rem;
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    border-bottom: none;
    text-align: right;
    padding: 0.45rem 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    flex-shrink: 0;
  }

  .data-table td > * {
    max-width: 65%;
  }

  .data-table td[data-label="Unidades"] > *,
  .data-table td[data-label="Departamentos"] > * {
    max-width: 72%;
  }

  .data-table td[data-label="Unidades"] .scope-chip-list,
  .data-table td[data-label="Departamentos"] .scope-chip-list {
    justify-content: flex-end;
    row-gap: 0.35rem;
  }

  .data-table td[data-label="Acoes"] {
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .data-table td[data-label="Acoes"]::before {
    margin-right: auto;
  }

  .data-table td[data-label="Acoes"] > * {
    max-width: none;
  }

  .data-table code {
    word-break: break-all;
  }

  .data-table td.text-right {
    text-align: right !important;
  }
}

/* ----------------------------- Fase 3.1: Conversas ----------------------------- */
.badge-neutral { background-color: rgba(148, 163, 184, 0.18); color: var(--text-secondary); }
.badge-warning { background-color: rgba(245, 158, 11, 0.16); color: #d97706; }
[data-theme="dark"] .badge-warning { color: #fbbf24; }
.input-sm { padding: 0.4rem 0.6rem; font-size: 0.85rem; }

.conversations-page .page-header {
  margin-bottom: 1rem;
}

/* Cabeçalho com contadores live (clicáveis) alinhados à direita. */
.conv-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.conv-counters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.conv-counter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 7rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s, transform 0.05s;
}

.conv-counter:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
}

.conv-counter:active { transform: translateY(1px); }

.conv-counter-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.conv-counter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.conv-counter.active {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.12);
}

.conv-counter.active .conv-counter-label { color: var(--text-primary); }

.conv-counter-alert .conv-counter-value { color: #d97706; }
[data-theme="dark"] .conv-counter-alert .conv-counter-value { color: #fbbf24; }

.conv-counter-alert.active {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.14);
}

.conv-counter-meus .conv-counter-value { color: var(--primary-color); }
.conv-counter-meus.active {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.12);
}

/* Barra de filtros compacta: rótulo + controle em coluna, numa linha só. */
.conv-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
  position: relative;
  z-index: 40;
  overflow: visible;
}

.conv-filters .filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.conv-filters .filter-group > label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.conv-filter-search {
  flex: 1 1 220px;
  min-width: 180px;
}

.conv-filters .filter-group-ms {
  position: relative;
  flex: 0 0 240px;
  width: 240px;
  min-width: 240px;
}

.conv-filters .filter-group-ms .multi-select-shell {
  width: 100%;
  flex: none;
}

/* Empilhamento: dropdown aberto da barra de filtros acima do bloco de conversas. */
.conv-filters .multi-select--dropdown.is-open {
  z-index: 41;
}

.conv-filters .multi-select-dropdown {
  z-index: 42;
  min-width: 100%;
}

/* Trigger + dropdown como um único bloco quando aberto (modo dropdown nos filtros). */
.conv-filters .multi-select--dropdown.is-open .multi-select-trigger {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.conv-filters .multi-select--dropdown.is-open .multi-select-dropdown {
  top: 100%;
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  left: 0;
  right: 0;
}

.conv-filter-actions {
  margin-left: auto;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
}

.conv-search-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.conv-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
}

/* Responsável: chips de papel (multi-seleção). */
.conv-chip-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.multi-select-group-label {
  padding: 0.5rem 0.6rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.4rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip input {
  accent-color: var(--primary-color);
}

.filter-chip:has(input:checked) {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.13);
  color: var(--text-primary);
}

.conversations-layout {
  display: grid;
  grid-template-columns: minmax(310px, 360px) 1fr;
  gap: 0;
  height: calc(100vh - 225px);
  min-height: 520px;
  overflow: hidden;
  padding: 0;
  position: relative;
  z-index: 1;
}

.conv-list-pane {
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.conv-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.conv-list-header strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-primary);
}


@media (max-width: 768px) {
  .conversations-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 520px;
  }

  .conv-list-pane {
    max-height: 260px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}

.conv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.conv-item {
  display: block;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.conv-item:hover { background-color: var(--bg-hover); }
.conv-item.active { background-color: var(--bg-hover); border-left-color: var(--primary-color); }
.conv-item-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.conv-item-id { font-weight: 800; font-size: 0.95rem; word-break: break-word; }
.conv-item-meta { display: flex; justify-content: space-between; margin-top: 0.25rem; font-size: 0.75rem; color: var(--text-secondary); }
.conv-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.queue-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 800;
}
.queue-pill.pending {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}
.conv-empty { padding: 1.5rem 0.85rem; color: var(--text-secondary); font-size: 0.9rem; text-align: center; }

.conv-thread-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.thread-placeholder { align-items: center; justify-content: center; }

.thread-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}
.thread-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 48%;
}
.thread-header-actions form {
  margin: 0;
}
.thread-transfer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.thread-transfer .input {
  width: 9rem;
  min-width: 0;
  height: 2.15rem;
  padding: 0.35rem 2rem 0.35rem 0.65rem;
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px;
}
.thread-contact-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.thread-avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-primary);
  font-weight: 900;
  text-transform: uppercase;
}
.thread-title { font-size: 1rem; margin: 0; word-break: break-word; }
.thread-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
}
.thread-subtitle span + span::before {
  content: "•";
  margin-right: 0.55rem;
  color: var(--text-light);
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  scroll-behavior: smooth;
}

.att-separator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.7rem;
  border: 1px dashed var(--border-color);
  border-radius: 999px;
  background-color: rgba(148, 163, 184, 0.08);
}

.att-separator-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.att-separator-meta {
  font-size: 0.72rem;
  color: var(--text-light);
  white-space: nowrap;
}

.msg {
  max-width: 70%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  position: relative;
}
.msg-entrada { align-self: flex-start; background-color: var(--bg-secondary); border: 1px solid var(--border-color); }
.msg-saida { align-self: flex-end; background-color: var(--primary-color); color: #fff; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-media {
  margin-bottom: 0.5rem;
}
.msg-media img {
  display: block;
  max-width: min(260px, 100%);
  max-height: 220px;
  border-radius: var(--radius-md);
  object-fit: cover;
}
.msg-media audio {
  width: min(280px, 100%);
  max-width: 100%;
}
.msg-document {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  background: rgba(148, 163, 184, 0.16);
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}
.msg-time { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: rgba(15, 23, 42, 0.72); text-align: right; }
.msg-saida .msg-time { color: rgba(255, 255, 255, 0.92); }
.msg-status-ok { color: var(--success-color); }
.msg-status-erro { color: var(--danger-color); font-weight: 600; cursor: help; border-bottom: 1px dashed; }
.msg-saida .msg-status-ok { color: rgba(255,255,255,0.9); }
.msg-saida .msg-status-erro { color: #fca5a5; }
.msg-media-thumb {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
}
.msg-media-thumb img {
  display: block;
  max-width: min(260px, 100%);
  max-height: 220px;
  border-radius: var(--radius-md);
  object-fit: cover;
  transition: opacity 0.15s;
}
.msg-media-thumb:hover img { opacity: 0.85; }
.msg-document {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  background: rgba(148, 163, 184, 0.16);
  color: inherit;
  font-weight: 800;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}
.msg-document:hover { background: rgba(148, 163, 184, 0.28); }

/* ---- Media modal ---- */
.media-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-modal[hidden] { display: none; }
.media-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}
.media-modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-width: min(90vw, 960px);
  max-height: 90vh;
  overflow: hidden;
}
.media-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.media-modal-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 120px;
}
.media-modal-img {
  max-width: 100%;
  max-height: calc(90vh - 80px);
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}
.media-modal-iframe {
  width: min(70vw, 800px);
  height: min(75vh, 700px);
  border: none;
  border-radius: var(--radius-md);
}
.thread-empty-state, .thread-placeholder p { text-align: center; padding: 2rem; }

/* ----------------------------- Fase 3.2: Relatorios ----------------------------- */
.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.filter-actions { justify-content: flex-end; }

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
}
.summary-value { font-size: 1.75rem; font-weight: 700; color: var(--primary-color); }
.summary-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }

@media (max-width: 720px) {
  .report-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ----------------------------- Fase 3.3: WhatsApp ----------------------------- */
.alert-info {
  padding: 0.9rem 1.1rem;
  background-color: rgba(12, 102, 138, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(12, 102, 138, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.data-table code { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-primary); }

/* ----------------------------- Fase 3.4: Envio ----------------------------- */
.thread-compose {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
}
.thread-compose-main { flex: 1; min-width: 0; }
.thread-compose .input { width: 100%; }
.thread-compose-input {
  resize: none;
  min-height: 2.5rem;
  max-height: 7.5rem;
  line-height: 1.4;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
.queue-pill-unidade {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.thread-compose-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.05rem;
}
.compose-tool {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.compose-tool:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.compose-tool.is-recording {
  color: #fff;
  background: var(--danger-color);
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}
.compose-tool input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.compose-file-name {
  margin-top: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-error { margin: 0 1.25rem 0.5rem; }
.thread-compose-readonly {
  justify-content: center;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .conv-counters {
    width: 100%;
  }

  .conv-counter {
    flex: 1 1 auto;
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .conv-filters .filter-group,
  .conv-filters .multi-select-shell,
  .conv-filter-search {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .conv-filter-actions {
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 820px) {
  .thread-header {
    flex-direction: column;
  }

  .thread-header-actions {
    max-width: none;
    justify-content: flex-start;
  }

  .thread-compose {
    flex-wrap: wrap;
  }

  .thread-compose-tools {
    order: 1;
  }

  .thread-compose-main {
    order: 3;
    flex: 1 1 100%;
  }

  .thread-compose > .btn {
    order: 2;
    margin-left: auto;
  }
}

/* ----------------------------- Fase 4.1: Dashboard ----------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.dashboard-block { padding: 1.25rem; }
.dashboard-block-wide { grid-column: 1 / -1; }
.dashboard-block-title { font-size: 0.95rem; margin: 0 0 1rem; color: var(--text-primary); }

.bar-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.bar-label { width: 120px; font-size: 0.82rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 10px; background-color: var(--bg-secondary); border-radius: 9999px; overflow: hidden; }
.bar-fill { height: 100%; background-color: var(--primary-color); border-radius: 9999px; }
.bar-value { width: 36px; text-align: right; font-size: 0.82rem; font-weight: 600; }

.peak-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 0.5rem; }
.peak-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.peak-bar { width: 100%; min-height: 2px; background-color: var(--primary-color); border-radius: 3px 3px 0 0; }
.peak-hour { font-size: 0.6rem; color: var(--text-light); margin-top: 0.25rem; }

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ----------------------------- Fase 4.3: Sandbox ----------------------------- */
.mt-1-5 { margin-top: 1.5rem; }

/* ----------------------------- Embedded Signup ----------------------------- */
.embedded-signup-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.embedded-signup-row p { margin: 0.25rem 0 0; }
#embedded-signup-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
#embedded-signup-status:empty { display: none; }

@media print {
  body {
    background: #fff !important;
    color: #111827 !important;
    font-size: 12px;
  }

  .sidebar,
  .sidebar-backdrop,
  .header,
  .header-actions,
  .report-filters,
  .btn,
  .thread-compose {
    display: none !important;
  }

  .content-wrapper,
  .content-wrapper.collapsed-margin {
    margin-left: 0 !important;
  }

  .main-content {
    padding: 0 !important;
    overflow: visible !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #d1d5db !important;
  }

  .reports-page .summary-value,
  .reports-page .data-table th,
  .reports-page .data-table td {
    color: #111827 !important;
  }
}
