/* =========================================================
   ROSSI CHAT — KANBAN DESIGN SYSTEM PRO
   ========================================================= */

:root {
  --bg-app: #f1f5f9;
  --bg-header: #090d16;
  --bg-column: #e8ecf2;
  --bg-column-header: rgba(255, 255, 255, 0.85);
  --bg-card: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  
  /* Brand Accents */
  --accent-presale: #2563eb;
  --accent-presale-light: #eff6ff;
  --accent-presale-border: #bfdbfe;
  
  --accent-postsale: #7c3aed;
  --accent-postsale-light: #faf5ff;
  --accent-postsale-border: #ddd6fe;
  
  --accent-answered: #059669;
  --accent-answered-light: #ecfdf5;
  --accent-answered-border: #a7f3d0;

  --accent-unanswerable: #64748b;
  --accent-unanswerable-light: #f1f5f9;
  --accent-unanswerable-border: #cbd5e1;

  /* Marketplaces */
  --meli-yellow: #f59e0b;
  --meli-bg: #fef3c7;
  --meli-text: #92400e;
  
  --shopee-orange: #f97316;
  --shopee-bg: #ffedd5;
  --shopee-text: #9a3412;

  --tiktok-ink: #010101;
  --tiktok-accent: #fe2c55;
  --tiktok-cyan: #25f4ee;
  --tiktok-bg: #ffe1e8;
  --tiktok-text: #b8123a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --shadow-card: 0 2px 6px -1px rgba(0, 0, 0, 0.06), 0 1px 3px -1px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 10px 18px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -2px rgba(0, 0, 0, 0.05);
  --shadow-header: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   HEADER
   ========================================================= */

.app-header {
  background: var(--bg-header);
  color: #fff;
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow-header);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* =========================================================
   MENU DE NAVEGAÇÃO LATERAL (US-030/US-031) — shell de duas
   colunas nas telas autenticadas (nav fixa + conteúdo). Reaproveita
   --bg-header pra manter a mesma identidade visual do header antigo.
   ========================================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.app-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-header);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-brand-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nav-brand-label {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.nav-brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.nav-group-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem 0.2rem;
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nav-subitems {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-subitem {
  margin-left: 1.1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.8rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item-active {
  background: #3b82f6;
  color: #fff;
}

/* Item ativo de cada plataforma usa a cor da própria marca em vez do azul
   genérico — reforça em qual tela o atendente está (US-033). */
.nav-item-meli.nav-item-active {
  background: var(--meli-yellow);
  color: var(--meli-text);
}

.nav-item-shopee.nav-item-active {
  background: var(--shopee-orange);
  color: #fff;
}

.nav-item-tiktok.nav-item-active {
  background: var(--tiktok-accent);
  color: #fff;
}

.nav-item-icon {
  font-size: 1.05rem;
}

.nav-footer {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.nav-footer-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nav-footer-nome {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.nav-footer-email {
  font-size: 0.68rem;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-logout:hover {
  background: rgba(255, 255, 255, 0.2);
}

.app-shell-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .app-nav {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 0.65rem 1rem;
    overflow-x: auto;
    gap: 1rem;
  }

  .nav-brand {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .nav-items {
    flex-direction: row;
    flex: none;
  }

  .nav-footer {
    flex-direction: row;
    align-items: center;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    margin-left: auto;
  }

  .nav-footer-user {
    display: none;
  }
}

/* Identidade da plataforma no cabeçalho (US-033) — cada tela é de um
   canal só, o selo reforça visualmente qual. `.channel-theme-*` fica no
   próprio <header> de cada template (estático, a tela já sabe seu canal). */
.channel-identity {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.channel-identity-icon {
  font-size: 1.1rem;
}

.channel-theme-meli .channel-identity {
  background: var(--meli-bg);
  color: var(--meli-text);
}

.channel-theme-shopee .channel-identity {
  background: var(--shopee-bg);
  color: var(--shopee-text);
}

.channel-theme-tiktok .channel-identity {
  background: var(--tiktok-bg);
  color: var(--tiktok-text);
}

/* Header Center Search */
.header-center {
  flex: 1;
  max-width: 460px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.6;
}

.search-box input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  padding: 0.5rem 1rem 0.5rem 2.4rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-box input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.channels-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.channel-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.channel-conectado .dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.channel-conectado .dot.pulse {
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.channel-inactive .dot {
  background: #64748b;
}

.channel-pending .dot {
  background: #f59e0b;
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-refresh:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

/* =========================================================
   KANBAN LAYOUT & STATS TOPBAR
   ========================================================= */

.kanban-layout {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kanban-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stats-overview {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.825rem;
}

.stat-label {
  color: var(--text-muted);
  font-weight: 600;
}

.stat-num {
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.8rem;
}

.stat-total .stat-num {
  background: #f1f5f9;
  color: #334155;
}

.stat-pending .stat-num {
  background: #fef3c7;
  color: #b45309;
}

.stat-answered .stat-num {
  background: #dcfce7;
  color: #15803d;
}

.quick-hints {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quick-hints code {
  background: #f1f5f9;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  color: #1e293b;
}

/* =========================================================
   KANBAN BOARD COLUMNS
   ========================================================= */

.kanban-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: flex-start;
}

@media (max-width: 700px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   TELA RESPONDIDOS (US-029/US-031) — página própria acessada pelo
   menu de navegação, separada em Pré-Venda/Pós-Venda; "Arquivados"
   (encerrados) e "Não é possível responder" ficam em archive-section
   logo abaixo das seções.
   ========================================================= */

.respondidos-pagina {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.respondidos-secoes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .respondidos-secoes {
    grid-template-columns: 1fr;
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-icon {
  font-size: 1.05rem;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
}

.sidebar-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.sidebar-secao {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sidebar-secao-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sidebar-secao-titulo {
  flex: 1;
}

.sidebar-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sidebar-cards-list .mensagem {
  padding: 0.75rem;
}

.empty-column-state-compact {
  padding: 1.25rem 0.75rem;
  font-size: 0.78rem;
}

/* Arquivo: "não é possível responder" — fora da dash principal (US-026),
   recolhido por padrão via <details>/<summary> nativos. */
.archive-section {
  margin-top: 1.25rem;
  background: var(--bg-column);
  border-radius: var(--radius-xl);
  border: 1px solid #dbe2ea;
  padding: 0.9rem;
}

.archive-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--text-main);
  user-select: none;
}

.archive-summary::-webkit-details-marker {
  display: none;
}

.archive-summary::before {
  content: '▸';
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.archive-section[open] .archive-summary::before {
  transform: rotate(90deg);
}

.archive-icon {
  font-size: 1rem;
}

.archive-title {
  font-size: 0.95rem;
}

.archive-sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
}

.archive-cards-list {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.kanban-column {
  background: var(--bg-column);
  border-radius: var(--radius-xl);
  padding: 0.9rem;
  border: 1px solid #dbe2ea;
  display: flex;
  flex-direction: column;
  min-height: 580px;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--bg-column-header);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.col-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.col-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.col-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.col-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.col-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.column-presale .col-badge {
  background: #dbeafe;
  color: var(--accent-presale);
}

.column-postsale .col-badge {
  background: #ede9fe;
  color: var(--accent-postsale);
}

.column-answered .col-badge {
  background: #d1fae5;
  color: var(--accent-answered);
}

.badge-unanswerable-count {
  background: var(--accent-unanswerable-light);
  color: var(--accent-unanswerable);
}

/* Card List in Columns */
.kanban-cards-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

/* Empty Column State */
.empty-column-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  border: 1px dashed #cbd5e1;
  gap: 0.4rem;
}

.empty-column-state span {
  font-size: 1.5rem;
}

/* =========================================================
   KANBAN CARDS
   ========================================================= */

.mensagem {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.mensagem:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.card-tipo-presale.mensagem-pendente {
  border-top: 3px solid var(--accent-presale);
}

.card-tipo-postsale.mensagem-pendente {
  border-top: 3px solid var(--accent-postsale);
}

.mensagem-respondida {
  border-top: 3px solid var(--accent-answered);
  opacity: 0.92;
}

.mensagem-impossivel {
  border-top: 3px solid var(--accent-unanswerable);
  opacity: 0.8;
}

/* Card Meta Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.canal {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-meli {
  background: var(--meli-bg);
  color: var(--meli-text);
  border: 1px solid #fde68a;
}

.badge-shopee {
  background: var(--shopee-bg);
  color: var(--shopee-text);
  border: 1px solid #fed7aa;
}

.badge-tiktok {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.cliente {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.cliente i {
  font-style: normal;
  font-size: 0.75rem;
}

.status {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.03em;
}

.status-pendente {
  background: #fef3c7;
  color: #b45309;
}

.status-respondida {
  background: #dcfce7;
  color: #15803d;
}

.status-impossivel {
  background: #e2e8f0;
  color: #475569;
}

/* Card Produto */
.card-produto {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
}

.produto-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background: #fff;
  flex-shrink: 0;
}

.produto-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.produto-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.03em;
}

.produto-titulo {
  font-size: 0.825rem;
  font-weight: 700;
  color: #0284c7;
  text-decoration: none;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

.produto-titulo:hover {
  color: #0369a1;
  text-decoration: underline;
}

.produto-meta-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.produto-preco {
  font-size: 0.8rem;
  font-weight: 800;
  color: #059669;
}

.produto-qtd {
  font-size: 0.7rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.badge-order-id {
  font-size: 0.68rem;
  font-weight: 700;
  background: #ede9fe;
  color: #6d28d9;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
}

/* Pergunta / Mensagem Bubble */
.card-pergunta {
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  position: relative;
}

.pergunta-presale {
  background: var(--accent-presale-light);
  border-left: 3px solid var(--accent-presale);
}

.pergunta-postsale {
  background: var(--accent-postsale-light);
  border-left: 3px solid var(--accent-postsale);
}

.pergunta-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pergunta-presale .pergunta-tag {
  color: var(--accent-presale);
}

.pergunta-postsale .pergunta-tag {
  color: var(--accent-postsale);
}

.card-pergunta .texto {
  font-size: 0.875rem;
  color: #1e293b;
  font-weight: 600;
  line-height: 1.4;
}

.card-timestamp {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 0.35rem;
}

.card-anexos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.anexo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
}

.anexo-link:hover {
  background: #e2e8f0;
}

/* Resposta Enviada */
.resposta-enviada {
  background: var(--accent-answered-light);
  border: 1px solid var(--accent-answered-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.8rem;
}

.resposta-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 0.15rem;
}

.resposta-corpo {
  font-size: 0.825rem;
  color: #166534;
  line-height: 1.35;
}

/* Impossível Responder */
.impossivel-responder {
  background: var(--accent-unanswerable-light);
  border: 1px solid var(--accent-unanswerable-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.8rem;
}

.impossivel-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.15rem;
}

.impossivel-corpo {
  font-size: 0.825rem;
  color: #475569;
  line-height: 1.35;
}

/* Responder Form */
.responder-caixa {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.faq-sugestao {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px dashed #f59e0b;
  border-radius: var(--radius-md);
  background: #fffbeb;
}

.faq-sugestao-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.faq-sugestao-texto {
  font-size: 0.8rem;
  color: #78350f;
  margin: 0;
}

.usar-sugestao {
  align-self: flex-start;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid #f59e0b;
  background: #fff;
  color: #b45309;
  cursor: pointer;
  transition: background 0.15s ease;
}

.usar-sugestao:hover {
  background: #fef3c7;
}

.responder-caixa textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.825rem;
  padding: 0.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text-main);
  resize: vertical;
  min-height: 3.25rem;
  transition: all 0.15s ease;
}

.responder-caixa textarea:focus {
  outline: none;
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.responder-acoes {
  display: flex;
  justify-content: flex-end;
}

.btn-primary, .responder {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover, .responder:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
}

.btn-primary:active, .responder:active {
  transform: translateY(0);
}

/* Canal Pendente Aviso */
.canal-pendente {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Loading Spinner */
.loading-state {
  text-align: center;
  padding: 4rem 1rem;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  margin: 0 auto 0.85rem auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   LOGIN PAGE — PREMIUM SAAS EXPERIENCE
   ========================================================= */

.login-body {
  background: radial-gradient(circle at 50% 15%, #1e293b 0%, #0f172a 50%, #090d16 100%);
  min-height: 100vh;
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-main);
  background-attachment: fixed;
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 2.75rem 2.25rem 2rem;
  background: #ffffff;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: loginFadeIn 0.35s ease-out;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.35rem;
}

.login-logo-box {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.45);
  margin-bottom: 0.75rem;
  transition: transform 0.2s ease;
}

.login-logo-box:hover {
  transform: scale(1.05);
}

.login-logo-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.login-brand-titles {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-brand-name {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #0f172a;
  line-height: 1.1;
}

.login-brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #64748b;
  margin-top: 0.2rem;
}

.login-header-text {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-header-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.login-header-text p {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.4;
  margin: 0;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

.input-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  font-size: 0.95rem;
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

.login-card input {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.85rem 1rem 0.85rem 2.65rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.login-card input::placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
}

.login-card input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.btn-login {
  margin-top: 0.4rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0.85rem;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 10px 20px -3px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px -3px rgba(37, 99, 235, 0.5);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.btn-login:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px -2px rgba(37, 99, 235, 0.3);
}

.erro {
  color: #ef4444;
  font-size: 0.825rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
  min-height: 1.25rem;
}

.login-card-footer {
  margin-top: 1.4rem;
  padding-top: 1.15rem;
  border-top: 1px solid #f1f5f9;
  text-align: center;
}

.login-card-footer p {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
  margin: 0;
}

.login-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2.25rem;
  text-align: center;
}

.developer-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

.developer-logo {
  max-width: 120px;
  height: auto;
  object-fit: contain;
  opacity: 0.85;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  transition: all 0.2s ease;
}

.developer-logo:hover {
  opacity: 1;
  transform: translateY(-2px) scale(1.03);
}

/* =========================================================
   CONVERSA PÓS-VENDA (US-028) — card-resumo + tela de thread
   ========================================================= */

.conversa-card-acoes {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.conversa-card .btn-abrir-conversa {
  flex: 1;
  justify-content: center;
}

/* Arquivamento (US-029) — pergunta avulsa respondida ganha "Arquivar";
   conversa pós-venda respondida ganha "Encerrar" (card e thread). */
.btn-arquivar,
.btn-encerrar-conversa,
.thread-encerrar {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-arquivar {
  margin-top: 0.5rem;
  align-self: flex-start;
}

.btn-arquivar:hover,
.btn-encerrar-conversa:hover,
.thread-encerrar:hover {
  background: var(--accent-unanswerable-light);
  border-color: var(--accent-unanswerable);
  color: var(--accent-unanswerable);
}

.btn-arquivar:disabled,
.btn-encerrar-conversa:disabled,
.thread-encerrar:disabled {
  opacity: 0.6;
  cursor: default;
}

.arquivado-aviso {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--accent-unanswerable-light);
  border: 1px solid var(--accent-unanswerable-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  display: inline-block;
}

.thread-encerrar-wrap {
  margin-top: 0.6rem;
}

.conversa-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.conversa-tag-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background: var(--accent-postsale-light);
  color: var(--accent-postsale);
  border: 1px solid var(--accent-postsale-border);
}

/* Overlay da tela de conversa */
.thread-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.thread-overlay.thread-open {
  display: flex;
}

.thread-modal {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45);
}

.thread-header {
  position: relative;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-column);
  flex-shrink: 0;
}

.thread-fechar {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thread-fechar:hover {
  background: rgba(15, 23, 42, 0.15);
  color: var(--text-main);
}

.thread-header-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  padding-right: 2rem;
}

.thread-produto {
  margin: 0 0 0.75rem;
}

.thread-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.thread-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem 0.2rem 0.6rem;
  border-radius: 9999px;
  background: var(--accent-postsale-light);
  color: var(--accent-postsale);
  border: 1px solid var(--accent-postsale-border);
}

.thread-tag-remover {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.65rem;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
}

.thread-tag-remover:hover {
  opacity: 1;
}

.thread-tag-input {
  font-family: inherit;
  font-size: 0.75rem;
  border: 1px dashed var(--border-card);
  background: transparent;
  border-radius: 9999px;
  padding: 0.2rem 0.65rem;
  color: var(--text-muted);
  min-width: 160px;
}

.thread-tag-input:focus {
  outline: none;
  border-color: var(--accent-postsale);
  color: var(--text-main);
}

/* Corpo com o histórico de mensagens, estilo balão de chat */
.thread-mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #f8fafc;
}

.thread-bolha {
  max-width: 78%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
  position: relative;
}

.thread-bolha p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-bolha-cliente {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 2px;
}

.thread-bolha-loja {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.thread-bolha-hora {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.65rem;
  opacity: 0.65;
}

.thread-bolha .card-anexos {
  margin-top: 0.4rem;
}

/* Caixa de resposta da thread — reaproveita o visual de .responder-caixa */
.thread-responder {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: #ffffff;
}

.thread-resposta-texto {
  width: 100%;
  font-family: inherit;
  font-size: 0.825rem;
  padding: 0.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text-main);
  resize: vertical;
  min-height: 3.25rem;
  transition: all 0.15s ease;
}

.thread-resposta-texto:focus {
  outline: none;
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.thread-enviar {
  align-self: flex-end;
}

/* =========================================================
   TELA USUÁRIOS (US-030) — só admin acessa.
   ========================================================= */

.usuarios-titulo {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.usuario-novo-secao {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.usuario-novo-secao h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.usuario-novo-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.usuario-novo-form input,
.usuario-novo-form select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  background: #f8fafc;
}

.usuario-novo-form input:focus,
.usuario-novo-form select:focus {
  outline: none;
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.usuarios-tabela-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.usuarios-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.usuarios-tabela th,
.usuarios-tabela td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

/* Colunas de nome/e-mail/papel/status (Usuários) são sempre curtas — não
   quebrar linha à toa. Pergunta/Resposta (FAQ) são texto livre longo e
   PRECISAM quebrar, senão a tabela inteira estoura de largura (achado ao
   vivo: uma resposta com token sem espaço deixava a tabela ilegível). */
.usuarios-tabela td:not(.faq-col-texto) {
  white-space: nowrap;
}

.faq-col-texto {
  white-space: normal;
  max-width: 360px;
  word-break: break-word;
}

.usuarios-tabela th {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.usuario-role {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
}

.usuario-role-admin {
  background: var(--accent-postsale-light);
  color: var(--accent-postsale);
}

.usuario-role-atendente {
  background: var(--accent-presale-light);
  color: var(--accent-presale);
}

.usuario-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
}

.usuario-ativo {
  background: var(--accent-answered-light);
  color: var(--accent-answered);
}

.usuario-inativo {
  background: var(--accent-unanswerable-light);
  color: var(--accent-unanswerable);
}

.usuario-acoes {
  display: flex;
  gap: 0.5rem;
}

.usuario-acoes button {
  background: var(--bg-column);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.usuario-acoes button:hover {
  background: #dbe2ea;
}

/* =========================================================
   TELA FAQ (US-032) — só admin acessa. Reaproveita
   .usuarios-tabela/.usuario-status/.usuario-acoes.
   ========================================================= */

.faq-novo-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}

.faq-novo-form input,
.faq-novo-form textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  background: #f8fafc;
  resize: vertical;
}

.faq-novo-form input:focus,
.faq-novo-form textarea:focus {
  outline: none;
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.faq-novo-form button {
  align-self: flex-end;
}

.faq-edit-question,
.faq-edit-resposta {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  background: #f8fafc;
}

.faq-origem {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background: var(--bg-column);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-left: 0.4rem;
  white-space: nowrap;
}

.faq-origem-manual {
  background: var(--accent-postsale-light);
  color: var(--accent-postsale);
}


