:root {
  --bg-app: #f1f7f5;
  --bg-sidebar: #082029;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.04);
  --bg-card: #ffffff;
  --border: #dbe7e2;
  --text-main: #082029;
  --text-muted: #4a646d;
  --primary: #007b57;
  --primary-hover: #00664a;
  --tt-purple: #00c98a;
  --tt-purple-hover: #00b07a;
  --danger: #aa3c45;
  --warn: #8c5b16;
  --success: #21724c;
  --info: #007652;
}

body[data-theme="dark"] {
  --bg-app: #061a21;
  --bg-card: #0c2a34;
  --border: #1d4651;
  --text-main: #ecf7f2;
  --text-muted: #96b7ad;
  --primary: #5cffc4;
  --primary-hover: #00c98a;
}

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

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Barra superior estilo ngx-loading-bar (#00c98a) do main.js */
.ngx-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: #00c98a;
  z-index: 10002;
  transition: width 0.3s ease;
}

/* ==========================================================================
   1. TELA DE LOGIN FIEL AO <app-login> DO TOMTICKET CONSOLE
   ========================================================================== */
.login-page-container {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.login-left {
  background: radial-gradient(circle at 20% 20%, #103b3c 0%, #082029 70%, #000000 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
}

.login-left-content {
  max-width: 560px;
  width: 100%;
}

.tt-brand-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.tt-brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00c98a, #00c98a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 201, 138, 0.45);
}

.tt-brand-hero h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tt-brand-sub {
  font-size: 12px;
  color: #8cddd5;
}

.login-hero-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 24px;
}

.demo-Removed-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}

.demo-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #f8fafc;
  margin-bottom: 4px;
}

.demo-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}

.demo-box-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.demo-profiles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.demo-profile-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: rgba(8, 32, 41, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.demo-profile-btn:hover {
  border-color: #5cffc4;
  background: rgba(0, 201, 138, 0.18);
  transform: translateY(-1px);
}

.demo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.demo-avatar.op-admin { background: #00c98a; color: #fff; }
.demo-avatar.op-n2 { background: #007b57; color: #fff; }
.demo-avatar.cust-mgr { background: #059669; color: #fff; }
.demo-avatar.cust-std { background: #d97706; color: #fff; }

.demo-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.demo-info strong {
  font-size: 12.5px;
}

.demo-info span {
  font-size: 11px;
  color: #cbd5e1;
}

.demo-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 201, 138, 0.35);
  color: #c9f2e1;
}

.demo-tag.tag-cust {
  background: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.login-arch-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-arch-badges span {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  color: #e2e8f0;
}

.login-right {
  background: #ffffff;
  color: #082029;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.form-signin {
  width: 100%;
  max-width: 390px;
}

.signin-logo-header {
  text-align: center;
  margin-bottom: 20px;
}

.signin-logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--tt-purple);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.signin-logo-header h2 {
  font-size: 21px;
  font-weight: 800;
  color: #082029;
}

.signin-logo-header p {
  font-size: 12.5px;
  color: #4a646d;
  margin-top: 4px;
}

.portal-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #e7f3ee;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}

.portal-tab {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #4a646d;
  cursor: pointer;
}

.portal-tab.active {
  background: #ffffff;
  color: var(--tt-purple);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tt-input-group {
  margin-bottom: 14px;
}

.tt-input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #30625d;
  margin-bottom: 5px;
}

.tt-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #cfe3da;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
  transition: all 0.15s;
}

/* Estilo exato do campo Conta do TomTicket Console capturado via REA */
.tt-input-wrap.tt-input-purple {
  background: #ecf9f3;
  border-color: #c9f2e1;
}

.tt-input-wrap:focus-within {
  border-color: var(--tt-purple);
  box-shadow: 0 0 0 3px rgba(0, 201, 138, 0.14);
  background: #fff;
}

.tt-input-icon {
  font-size: 14px;
  margin-right: 8px;
}

.tt-input-wrap input {
  border: none !important;
  background: transparent !important;
  padding: 10px 4px;
  font-size: 13.5px;
  width: 100%;
  outline: none;
  color: #082029;
}

.tt-login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 16px;
  font-size: 12px;
  color: #4a646d;
}

.tt-remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.tt-2fa-box {
  background: #ecf9f3;
  border: 1px solid #c9f2e1;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.tt-2fa-box label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #0a5c42;
  margin-bottom: 6px;
}

.tt-2fa-box input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #a5e6cc;
  border-radius: 6px;
  font-size: 13px;
}

/* Botão roxo oficial #00c98a do TomTicket Console */
.btn-purple {
  width: 100%;
  background: var(--tt-purple);
  color: #ffffff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-purple:hover {
  background: var(--tt-purple-hover);
}

.signin-footer-links {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: #4a646d;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.signin-footer-links a {
  color: var(--tt-purple);
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   2. SHELL DO CONSOLE DO ATENDENTE / ADMIN
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 265px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  border-right: 1px solid #123845;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid #123845;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #00c98a, #007b57);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

.brand h1 {
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 11px;
  color: #96b7ad;
}

/* Card de Status Online / Pausa do Operador */
.operator-status-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px;
  margin-top: 12px;
}

.op-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #00c98a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.op-card-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.op-card-info strong {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-card-info span {
  font-size: 11px;
  color: #96b7ad;
}

.op-pause-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online { background: #22c55e; }
.status-dot.paused { background: #f59e0b; }

.btn-xs-outline {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #dbe7e2;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  cursor: pointer;
}

.nav-section {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #96b7ad;
  padding: 0 8px 4px;
}

.nav-item,
.nav-subitem {
  background: transparent;
  border: none;
  color: #cfe3da;
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover,
.nav-subitem:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.nav-subitem.active {
  background: rgba(0, 123, 87, 0.25);
  color: #5cffc4;
  font-weight: 600;
}

.badge {
  background: #30625d;
  color: #dbe7e2;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.badge-warn { background: rgba(217, 119, 6, 0.25); color: #fcd34d; }
.badge-info { background: rgba(2, 132, 199, 0.25); color: #7dd3fc; }
.badge-success { background: rgba(5, 150, 105, 0.25); color: #6ee7b7; }
.badge-danger { background: rgba(220, 38, 38, 0.35); color: #fca5a5; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #123845;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-sidebar-action {
  background: rgba(0, 201, 138, 0.22);
  color: #c9f2e1;
  border: 1px solid rgba(92, 255, 196, 0.35);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-sidebar-logout {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   MAIN CONTENT & TOPBAR
   ========================================================================== */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrapper {
  flex: 1;
}

.search-wrapper input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-app);
  color: var(--text-main);
}

.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-bar select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--bg-card);
  color: var(--text-main);
}

.view-mode-toggle {
  display: flex;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* ==========================================================================
   VIEWS & SPLIT WORKSPACE
   ========================================================================== */
.module-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.module-inner-scroll {
  padding: 20px 24px;
  overflow-y: auto;
  height: 100%;
}

.module-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
}

.module-header-banner h2 {
  font-size: 17px;
  margin-bottom: 4px;
}

.module-header-banner p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.workspace-split {
  display: grid;
  grid-template-columns: 390px 1fr;
  flex: 1;
  overflow: hidden;
}

.ticket-list-pane {
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pane-Action-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.ticket-list {
  display: flex;
  flex-direction: column;
}

.ticket-card {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.ticket-card:hover {
  background: rgba(0, 123, 87, 0.04);
}

.ticket-card.selected {
  background: rgba(0, 123, 87, 0.1);
  border-left: 4px solid var(--primary);
}

.ticket-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.ticket-id {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
}

.ticket-subject {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.35;
}

.ticket-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Badges de Prioridade e Status */
.prio-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

.prio-1 { background: #ecfdf5; color: #047857; }
.prio-2 { background: #ecf7f2; color: #00664a; }
.prio-3 { background: #fffbeb; color: #b45309; }
.prio-4 { background: #fef2f2; color: #b91c1c; }

.status-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.status-waiting_attendant { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #e0f2fe; color: #075985; }
.status-waiting_customer { background: #f5f0ff; color: #6846a0; }
.status-resolved { background: #d1fae5; color: #065f46; }

.org-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: #e2f3ec;
  color: #0a5c42;
}

.mgr-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: #fef3c7;
  color: #92400e;
}

/* ==========================================================================
   QUADRO KANBAN DE 4 COLUNAS (hasKanban do UserInfoService)
   ========================================================================== */
.kanban-board-wrapper {
  flex: 1;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
}

.kanban-columns-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(270px, 1fr));
  gap: 14px;
  height: 100%;
}

.kanban-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 13px;
}

.kanban-col-body {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.kanban-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.kanban-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.kanban-card-actions select {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

/* ==========================================================================
   PAINEL DE DETALHES DO CHAMADO + CRONÔMETRO STOPWATCH (useStopWatch)
   ========================================================================== */
.ticket-detail-pane {
  padding: 20px 24px;
  overflow-y: auto;
}

.empty-detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.detail-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.detail-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.detail-actions select {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text-main);
}

/* Cronômetro StopWatch do TomTicket */
.stopwatch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ecf9f3;
  border: 1px solid #c9eadb;
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 14px;
  color: #0a5c42;
  font-size: 12.5px;
}

.stopwatch-display {
  font-family: monospace;
  font-size: 15px;
  font-weight: 800;
  color: #007b57;
  background: #fff;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid #a5e6cc;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.meta-box {
  background: var(--bg-app);
  padding: 9px 11px;
  border-radius: 8px;
}

.meta-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.meta-value {
  font-size: 12.5px;
  font-weight: 600;
}

/* Thread de Mensagens */
.thread-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.message-bubble.initial {
  border-left: 4px solid var(--primary);
}

.message-bubble.internal {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

.bubble-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.bubble-author {
  font-weight: 700;
  color: var(--text-main);
}

.bubble-body {
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.reply-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.reply-box h4 {
  font-size: 13.5px;
  margin-bottom: 10px;
}

.macro-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.macro-bar select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}

.reply-box textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 10px;
  background: var(--bg-app);
  color: var(--text-main);
}

.reply-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   DASHBOARD KPI & GRÁFICOS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.kpi-card .kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-card .kpi-val {
  font-size: 24px;
  font-weight: 800;
}

.kpi-card .kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.dash-card h3 {
  font-size: 14px;
  margin-bottom: 14px;
}

.bar-chart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-row-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.bar-track {
  width: 100%;
  height: 9px;
  background: var(--bg-app);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

/* ==========================================================================
   ORGANIZAÇÕES, KB, MACROS & ADMIN
   ========================================================================== */
.org-grid,
.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.org-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.org-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.org-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-app);
  padding: 10px;
  border-radius: 8px;
  text-align: center;
}

.org-stat-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.org-stat-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #dbe7e2;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-item {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

/* Sugestão Automática da Base de Conhecimento */
.kb-suggestion-box {
  background: #ecf7f2;
  border: 1px solid #c9eadb;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.kb-suggestion-box h5 {
  font-size: 12.5px;
  color: #0a5c42;
  margin-bottom: 6px;
}

.kb-sug-item {
  background: #ffffff;
  border: 1px solid #dbefe7;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  font-size: 12px;
}

/* ==========================================================================
   3. PORTAL DO CLIENTE (#customerPortalApp)
   ========================================================================== */
.customer-portal-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-app);
}

.cp-header {
  background: #103b3c;
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cp-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cp-brand h2 {
  font-size: 16px;
}

.cp-brand span {
  font-size: 12px;
  color: #a6ceca;
}

.cp-nav-tabs {
  display: flex;
  gap: 8px;
}

.cp-tab {
  background: rgba(255, 255, 255, 0.1);
  color: #e2f3ec;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.cp-tab.active {
  background: #00c98a;
  color: #ffffff;
}

.cp-body {
  flex: 1;
  padding: 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cp-org-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid #00c98a;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.cp-split {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  min-height: 520px;
}

.cp-list-col,
.cp-detail-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
}

.cp-detail-col {
  padding: 18px;
}

.cp-new-ticket-card {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.cp-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 18px;
}

/* ==========================================================================
   MODAIS & FORMULÁRIOS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 32, 41, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 16px;
}

.modal-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row.three-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-main);
}

.customer-link-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customer-link-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}

.quota-banner {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ecf7f2;
  border: 1px solid #c9eadb;
  color: #0a5c42;
}

.custom-fields-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
}

.custom-fields-header {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
}

.macro-vars-helper {
  background: #ecf9f3;
  border: 1px solid #c9f2e1;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
}

.macro-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip-btn {
  background: #ffffff;
  border: 1px solid #a5e6cc;
  color: #0a5c42;
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.chip-btn:hover {
  background: #00c98a;
  color: #fff;
}

.modal-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #082029;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 2000;
}
