/**
 * NuvemTech — Central Interna de Suporte de TI
 * Design System shadcn/ui (Zinc-950) com Dark Scrollbars e Separação de Personas
 */

:root {
  color-scheme: dark;
  --escala-fonte: 1;
  --bg-page: #09090b;
  --bg-card: #121215;
  --bg-muted: #1f1f23;
  --bg-input: #09090b;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #ef4444;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

html[data-contraste="alto"] {
  --bg-page: #000000;
  --bg-card: #09090b;
  --bg-muted: #18181b;
  --border-color: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #f4f4f5;
  --text-muted: #e4e4e7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #27272a transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

html {
  font-size: calc(14.5px * var(--escala-fonte));
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  background-image: radial-gradient(ellipse 75% 45% at 50% -15%, rgba(79, 70, 229, 0.13), transparent);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.84em;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  color: #e4e4e7;
}

.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;
}

.oculto {
  display: none !important;
}

.pular-conteudo {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.pular-conteudo:focus {
  top: 0.75rem;
}

.container {
  width: min(1240px, 94%);
  margin-inline: auto;
}

/* Navbar shadcn/ui */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
}

.navbar-inner {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marca {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.marca-icone {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--text-primary);
  color: var(--bg-page);
  display: grid;
  place-items: center;
}

.marca-titulo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.separador-barra {
  color: var(--text-muted);
}

.marca-titulo span:last-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.badge-status-online {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

.ponto-online {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Seletor de Persona no Topo (Segmented Control shadcn/ui) */
.seletor-visao {
  display: inline-flex;
  background: #141418;
  padding: 0.22rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.visao-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.32rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.visao-tab:hover {
  color: var(--text-primary);
}

.visao-tab.ativo {
  background: var(--bg-muted);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.contador-pilula {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.06rem 0.42rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.25);
  color: #c7d2fe;
}

.navbar-acoes {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.divisor-vertical {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 0.2rem;
}

.barra-acessibilidade {
  display: flex;
  gap: 0.15rem;
}

/* Botões padrão shadcn/ui */
.btn-primary-shadcn {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 0.5rem 1.05rem;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.btn-outline-sm {
  background: #141418;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.34rem 0.72rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline-sm:hover {
  background: var(--bg-muted);
  border-color: var(--border-hover);
}

.btn-ghost-icon {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-ghost-icon:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* Palco Principal */
.palco-principal {
  flex: 1;
  padding: 1.2rem 0;
  display: flex;
  flex-direction: column;
}

.card-shadcn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

/* =================================================================
   VISÃO 1: PORTAL DO COLABORADOR (Sem scroll de página, tudo alinhado)
   ================================================================= */
.visao-colaborador {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 1.1rem;
  height: calc(100vh - 130px);
  min-height: 380px;
  max-height: 760px;
}

.coluna-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
}

.agente-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-shadcn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(79, 70, 229, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.82rem;
}

.agente-info h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
}

.agente-info p {
  margin: 0.1rem 0 0;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.tabs-shadcn {
  display: inline-flex;
  background: var(--bg-input);
  padding: 0.18rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.26rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}

.tab-btn.ativo {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.atalhos-servicos {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 9, 11, 0.35);
}

.chip-shadcn {
  background: #18181c;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-shadcn:hover {
  background: rgba(79, 70, 229, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--text-primary);
}

.chat-mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg-bolha {
  max-width: 82%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  line-height: 1.5;
}

.msg-bot {
  align-self: flex-start;
  background: #1a1a1f;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg-cabecalho {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.msg-user .msg-cabecalho {
  color: rgba(255, 255, 255, 0.75);
}

.msg-card-protocolo {
  margin-top: 0.5rem;
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(9, 9, 11, 0.6);
  border-left: 2px solid var(--primary-hover);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.barra-voz {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 1.15rem;
  background: rgba(79, 70, 229, 0.1);
  border-top: 1px solid var(--border-color);
}

.ondas-audio {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.ondas-audio span {
  width: 3px;
  height: 6px;
  border-radius: 99px;
  background: var(--primary-hover);
  animation: ondaVoz 1.1s infinite ease-in-out;
}

.ondas-audio span:nth-child(2) {
  animation-delay: 0.15s;
}
.ondas-audio span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ondaVoz {
  0%,
  100% {
    height: 6px;
    opacity: 0.5;
  }
  50% {
    height: 15px;
    opacity: 1;
  }
}

.voz-status {
  flex: 1;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.chat-input-area {
  display: flex;
  gap: 0.55rem;
  padding: 0.8rem 1.15rem;
  border-top: 1px solid var(--border-color);
  background: #0d0d10;
}

.input-shadcn {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.52rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

.input-shadcn:focus {
  border-color: var(--primary-hover);
}

/* Coluna Direita do Colaborador: Minhas Solicitações */
.coluna-meus-chamados {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  height: 100%;
  min-height: 0;
}

.painel-chamados-colab {
  flex: 1;
  min-height: 0;
  padding: 1.05rem 1.15rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bloco-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.bloco-topo h2,
.bloco-topo h3 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
}

.bloco-topo p {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.lista-chamados {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.item-chamado {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: #17171c;
  border: 1px solid var(--border-color);
}

.item-chamado-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.item-chamado-topo strong {
  font-size: 0.84rem;
  font-weight: 600;
}

.item-chamado-resumo {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.item-chamado-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.tag-status-chamado {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.card-widget-externo {
  padding: 0.9rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-widget-externo strong {
  display: block;
  font-size: 0.82rem;
}

.card-widget-externo p {
  margin: 0.12rem 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* =================================================================
   VISÃO 2: PAINEL DO SUPERVISOR
   ================================================================= */
.visao-supervisor {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.barra-topo-supervisor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.barra-topo-supervisor h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.barra-topo-supervisor p {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.acoes-supervisor {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.cronometro-badge {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
}

.grade-metricas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.card-metrica {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metrica-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.badge-shadcn,
.tag-kpi {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.tag-kpi.alerta {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.metrica-valor {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.metrica-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.grade-supervisor-inferior {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.bloco-lateral {
  padding: 1.1rem 1.2rem;
}

.grade-equipes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.item-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  background: #17171c;
  border: 1px solid var(--border-color);
}

.item-fila.ativa {
  background: rgba(79, 70, 229, 0.16);
  border-color: rgba(99, 102, 241, 0.55);
}

.fila-info strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
}

.fila-info small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.badge-fila {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-muted);
  color: var(--text-primary);
}

.status-encaminhamento {
  margin: 0.7rem 0 0;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.barra-progresso-sentimento {
  height: 6px;
  border-radius: 999px;
  background: #17171c;
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.barra-preenchimento {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--emerald));
  transition: width 0.3s ease;
}

.lens-transcricao {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.5rem;
  max-height: 135px;
  overflow-y: auto;
  display: grid;
  gap: 0.4rem;
  font-size: 0.75rem;
  background: rgba(9, 9, 11, 0.35);
  border-radius: var(--radius-sm);
}

.lens-transcricao li {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.lens-papel {
  min-width: 50px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lens-texto {
  flex: 1;
  color: var(--text-secondary);
}

.lens-sent {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  padding-right: 0.2rem;
}

.etapas-compactas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-height: 140px;
  overflow-y: auto;
}

.passo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  background: #17171c;
  font-size: 0.75rem;
}

.passo-marca {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.passo-corpo {
  flex: 1;
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}

.passo-corpo small {
  color: var(--text-muted);
}

.passo-tempo {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.alertas-qualidade {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  font-size: 0.74rem;
}

.alertas-qualidade li {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(79, 70, 229, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text-secondary);
}

.vazio {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 0;
}

.rodape-clean {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.rodape-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.rodape-direita {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.texto-suave-xs {
  font-size: 0.73rem;
}

.link-discreto {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.73rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

@media (max-width: 960px) {
  .visao-colaborador {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }
  .grade-metricas,
  .grade-supervisor-inferior {
    grid-template-columns: 1fr;
  }
}
