/* ============================================================
   Sistema de design do painel
   Fonte dos valores: CSS do site de referencia (nexgran.store)
   mais os prints do prototipo.

   Este arquivo e a UNICA fonte de estilo. Conforme cada tela for
   migrada, apague o <style> dela e use as classes daqui.

   Convencao de nomes em portugues, igual ao resto do projeto.
   ============================================================ */

:root {
  /* fundo */
  --bg:             #07070b;
  --bg-sidebar:     #0b0a0d;
  --surface:        #191817;
  --surface-2:      #1f1e1c;
  --glass:          rgba(36, 34, 32, .86);
  --line:           rgba(255, 255, 255, .12);
  --line-forte:     rgba(255, 255, 255, .20);

  /* marca */
  --brand:          #f04d2f;
  --brand-2:        #ff7a00;
  --gold:           #e9a62f;
  --gold-2:         #ffc247;
  --brand-gradient: linear-gradient(135deg, #f04d2f, #e9a62f);
  --glow:           0 16px 50px rgba(240, 77, 47, .20);

  /* texto */
  --text:           #ffffff;
  --muted:          #aaa39b;
  --muted-2:        #7d776f;

  /* estado */
  --ok:             #22c55e;
  --warn:           #ffc247;
  --danger:         #ff2f72;

  /* forma */
  --r-sm:   8px;
  --r-md:  14px;
  --r-lg:  18px;
  --r-pill: 999px;

  /* medidas */
  --sidebar-w: 212px;
  --topbar-h:  56px;

  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand-2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .10);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .18); background-clip: content-box; }

/* ============================================================
   ESTRUTURA
   <body class="app">
     <aside class="sidebar"> ... </aside>
     <div class="area">
       <header class="topbar"> ... </header>
       <main class="conteudo"> ... </main>
     </div>
   ============================================================ */

/* A barra lateral e fixa, nao um item de grid. Com grid + position:sticky a
   caixa da barra era esticada para a altura da linha inteira, entao nao havia
   o que grudar: o conteudo dela rolava junto com a pagina e a barra sumia.
   Fixa resolve e ainda permite rolagem propria quando o menu for longo. */
.app {
  min-height: 100vh;
}

.area {
  margin-left: var(--sidebar-w);  /* reserva o espaco da barra fixa */
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.conteudo {
  padding: 26px 30px 60px;
  max-width: 1420px;
  width: 100%;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  z-index: 40;
}

.sidebar-marca {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 20px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .02em;
}

.sidebar-marca .marca-icone {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--brand-gradient);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800; color: #fff;
  flex: 0 0 auto;
}

.sidebar-grupo {
  padding: 0 12px;
  margin-bottom: 6px;
}

.sidebar-rotulo {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 14px 10px 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}

.sidebar-item.ativo {
  background: rgba(240, 77, 47, .13);
  border-color: rgba(240, 77, 47, .28);
  color: var(--brand-2);
  font-weight: 600;
}

.sidebar-item svg { width: 17px; height: 17px; flex: 0 0 auto; }

.sidebar-contador {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, .07);
  border-radius: var(--r-pill);
  padding: 1px 8px;
}

.sidebar-item.ativo .sidebar-contador {
  background: rgba(240, 77, 47, .20);
  color: var(--brand-2);
}

.sidebar-rodape { margin-top: auto; padding: 12px; }

.cartao-agente {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 12px;
  margin-bottom: 10px;
}

.cartao-agente .titulo {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600;
}

.cartao-agente .descricao {
  color: var(--muted-2);
  font-size: 11px;
  margin-top: 3px;
  line-height: 1.35;
}

.sidebar-usuario {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: #fff;
  flex: 0 0 auto;
}

.sidebar-usuario .nome { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.sidebar-usuario .papel { font-size: 11px; color: var(--muted-2); }

/* ---------- topbar ---------- */
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(7, 7, 11, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.trilha { font-size: 13px; color: var(--muted-2); display: flex; align-items: center; gap: 7px; }
.trilha .atual { color: var(--text); font-weight: 600; }
.topbar-direita { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* botao de abrir menu no celular */
.btn-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 8px;
  cursor: pointer;
}

/* ---------- pills e selos ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  white-space: nowrap;
}
.pill-ok     { background: rgba(34, 197, 94, .13);  border-color: rgba(34, 197, 94, .32);  color: #86efac; }
.pill-aviso  { background: rgba(255, 194, 71, .13); border-color: rgba(255, 194, 71, .32); color: #fde68a; }
.pill-erro   { background: rgba(255, 47, 114, .13); border-color: rgba(255, 47, 114, .32); color: #fecdd3; }
.pill-marca  { background: rgba(240, 77, 47, .14);  border-color: rgba(240, 77, 47, .32);  color: #ffb199; }

.ponto { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.ponto-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.ponto-erro { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 47, 114, .16); }

/* ---------- cabecalho de pagina ---------- */
.pagina-sobrancelha {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 8px;
}

.pagina-titulo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  line-height: 1.15;
}

.pagina-apoio { color: var(--muted); font-size: 14px; margin: 0 0 26px; }

/* ---------- cartoes ---------- */
.cartao {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}

.cartao-titulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; margin: 0;
}

.cartao-apoio { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* destaque do topo */
.cartao-destaque {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(240, 77, 47, .26);
  border-radius: var(--r-lg);
  padding: 26px 28px;
  margin-bottom: 26px;
  background:
    radial-gradient(900px 300px at 85% 10%, rgba(240, 77, 47, .20), transparent 60%),
    radial-gradient(700px 260px at 10% 90%, rgba(233, 166, 47, .12), transparent 60%),
    var(--surface);
}
.cartao-destaque h2 { font-size: 24px; font-weight: 800; margin: 12px 0 6px; letter-spacing: -.02em; }
.cartao-destaque p  { color: var(--muted); margin: 0 0 18px; max-width: 60ch; }

/* ---------- KPI ---------- */
.grade-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 17px 18px;
  position: relative;
}
.kpi .rotulo { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; padding-right: 34px; }
.kpi .valor  { font-size: 32px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.kpi .valor .unidade { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .valor .fracao  { font-size: 13px; font-weight: 700; color: var(--ok); margin-left: 7px; }
.kpi .variacao { font-size: 11.5px; margin-top: 7px; color: var(--muted); }
.kpi .variacao.sobe  { color: var(--ok); }
.kpi .variacao.desce { color: var(--danger); }

.kpi .icone {
  position: absolute; top: 15px; right: 15px;
  width: 28px; height: 28px;
  border-radius: 9px;
  background: rgba(240, 77, 47, .13);
  border: 1px solid rgba(240, 77, 47, .24);
  display: grid; place-items: center;
  color: var(--brand-2);
}
.kpi .icone svg { width: 15px; height: 15px; }

/* ---------- botoes ---------- */
.btn-marca, .btn-fantasma, .btn-sutil {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--r-pill);
  font-weight: 650;
  font-size: 13.5px;
  padding: 9px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: transform .12s, box-shadow .15s, background .15s;
  text-align: center;
}
.btn-marca {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--glow);
}
.btn-marca:hover { transform: translateY(-1px); color: #fff; }

.btn-fantasma {
  background: rgba(255, 255, 255, .05);
  border-color: var(--line);
  color: var(--text);
}
.btn-fantasma:hover { background: rgba(255, 255, 255, .09); color: var(--text); }

.btn-sutil {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 13px;
}
.btn-sutil:hover { color: var(--text); border-color: var(--line-forte); }

.btn-perigo {
  background: rgba(255, 47, 114, .12);
  border-color: rgba(255, 47, 114, .32);
  color: #fecdd3;
}
.btn-perigo:hover { background: rgba(255, 47, 114, .20); color: #fff; }

.btn-marca:disabled, .btn-fantasma:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- formularios ---------- */
.rotulo-campo {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

/* Especificidade baixa de proposito: (0,1,0). Antes esta regra listava
   input[type="..."].campo, o que a tornava (0,2,1) e fazia com que qualquer
   ajuste por contexto, como .tela-login .campo, fosse ignorado. Era o bug do
   icone sobrepondo o texto nos campos do login. */
.campo {
  width: 100%;
  background: rgba(7, 7, 11, .75);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.campo:focus { border-color: rgba(240, 77, 47, .55); box-shadow: 0 0 0 3px rgba(240, 77, 47, .15); }
.campo::placeholder { color: var(--muted-2); }
textarea.campo { resize: vertical; min-height: 90px; line-height: 1.5; }

/* seletor de arquivo */
input[type="file"].campo { padding: 8px 11px; }
input[type="file"].campo::file-selector-button {
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-pill);
  padding: 5px 13px;
  margin-right: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
}

/* ---------- tabelas ---------- */
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tabela tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .88);
  vertical-align: middle;
}
.tabela tbody tr:hover td { background: rgba(255, 255, 255, .03); }
.tabela tbody tr:last-child td { border-bottom: none; }

/* ---------- barra de progresso ---------- */
.barra {
  height: 7px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.barra > i {
  display: block; height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand-gradient);
}
.barra.verde > i { background: linear-gradient(90deg, #22c55e, #4ade80); }
.barra.azul  > i { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

.linha-barra { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.linha-barra .valor { font-weight: 700; }

/* ---------- avisos ---------- */
.aviso {
  display: flex; align-items: flex-start; gap: 10px;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
}
.aviso-ok    { background: rgba(34, 197, 94, .10);  border-color: rgba(34, 197, 94, .32);  color: #bbf7d0; }
.aviso-erro  { background: rgba(255, 47, 114, .10); border-color: rgba(255, 47, 114, .35); color: #fecdd3; }
.aviso-atencao { background: rgba(255, 194, 71, .09); border-color: rgba(255, 194, 71, .32); color: #fde68a; }

/* ---------- chat ---------- */
.balao {
  max-width: 72%;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  margin-bottom: 12px;
}
.balao .legenda { font-size: 10.5px; color: var(--muted-2); margin-top: 5px; }

.balao-cliente {
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-right: auto;
  border-bottom-left-radius: 5px;
}
.balao-ia {
  background: linear-gradient(135deg, rgba(240, 77, 47, .88), rgba(200, 60, 35, .88));
  margin-left: auto;
  border-bottom-right-radius: 5px;
  color: #fff;
}
.balao-ia .legenda { color: rgba(255, 255, 255, .72); }
.balao-humano {
  background: rgba(233, 166, 47, .18);
  border: 1px solid rgba(233, 166, 47, .32);
  margin-left: auto;
  border-bottom-right-radius: 5px;
}

/* ---------- utilitarios ---------- */
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.mono { font-family: var(--mono); }
.pequeno { font-size: 12px; }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grade-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.pilha   { display: flex; flex-direction: column; gap: 14px; }
.linha   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.espaco  { margin-left: auto; }
.cortar  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   RESPONSIVO
   Abaixo de 992px a sidebar vira menu sobreposto.
   O botao .btn-menu da topbar alterna a classe .aberta no body.
   ============================================================ */
@media (max-width: 992px) {
  .area { margin-left: 0; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 262px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, .6);
  }
  body.menu-aberto .sidebar { transform: translateX(0); }

  body.menu-aberto::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 50;
  }

  .btn-menu { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .conteudo { padding: 20px 16px 50px; }
  .pagina-titulo { font-size: 23px; }
  .cartao-destaque { padding: 20px; }
  .balao { max-width: 88%; }
}

@media (max-width: 560px) {
  .grade-kpi { grid-template-columns: 1fr 1fr; gap: 11px; }
  .kpi .valor { font-size: 25px; }
  .kpi .rotulo { font-size: 11.5px; }
}

/* ============================================================
   Convivencia com o Bootstrap, que ainda e carregado nas telas
   nao migradas. Sem isto o Bootstrap pinta fundo e texto por cima.
   ============================================================ */
.table, .table > :not(caption) > * > * { background-color: transparent !important; color: inherit !important; }
.form-control, .form-select {
  background: rgba(7, 7, 11, .75) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  border-radius: 11px !important;
}
.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 3px rgba(240, 77, 47, .15) !important;
  border-color: rgba(240, 77, 47, .55) !important;
}
.modal-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r-lg) !important;
}
.btn-close { filter: invert(1); opacity: .85; }

/* Etapa 1: login do cliente e conexão. Estilos restritos a estas telas. */
.tela-login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(ellipse at 20% 10%, rgba(240,77,47,.13), transparent 50%), var(--bg); }
.login-container { width: 100%; max-width: 480px; padding: 32px 20px; }
.login-card { padding: 40px; box-shadow: 0 24px 80px rgba(0,0,0,.35); backdrop-filter: blur(16px); }
.tela-login .header { margin-bottom: 32px; }
.tela-login .logo-area { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--brand-gradient); margin-bottom: 28px; box-shadow: var(--glow); }
.tela-login h1 { font-size: 27px; letter-spacing: -.035em; margin: 0; }
.tela-login p { color: var(--muted); font-size: 13px; }
.tela-login .form-group { margin-bottom: 20px; }
.tela-login label { display: block; font-size: 13px; margin-bottom: 8px; }
.tela-login .input-wrapper { position: relative; }
.tela-login .input-wrapper svg { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.tela-login .campo { padding: 14px 14px 14px 43px; }
.tela-login .btn-login { width: 100%; padding: 14px; margin-top: 8px; }
.tela-login .btn-login svg { width: 18px; height: 18px; }
.tela-login .login-rodape { text-align: center; margin: 24px 0 0; font-size: 12px; }
.tela-conexao { --border: var(--line); --accent: var(--brand); --terminal-green: var(--ok); }
.tela-conexao .glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 20px; }
.tela-conexao .conexao-resumo { background: radial-gradient(ellipse at top right, rgba(240,77,47,.15), transparent 65%), var(--surface); }
.tela-conexao .conexao-subtitulo { font-size: 18px; }
.tela-conexao .text-muted { color: var(--muted) !important; }
.tela-conexao .text-primary { color: var(--brand-2) !important; }
.tela-conexao .status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 12px; }
.tela-conexao .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.tela-conexao .dot.ok { background: var(--ok); }
.tela-conexao .dot.bad { background: var(--danger); }
.tela-conexao .dot.warn { background: var(--warn); }
.tela-conexao .plan-warning { display: flex; gap: 10px; padding: 14px; margin-bottom: 20px; border-radius: var(--r-md); color: #fde68a; background: rgba(255,194,71,.09); border: 1px solid rgba(255,194,71,.3); }
.tela-conexao .btn-action { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 13px; font-weight: 600; }
.tela-conexao .btn-action:hover { filter: brightness(1.15); }
.tela-conexao .btn-action:disabled { opacity: .5; cursor: not-allowed; }
.tela-conexao .btn-stop { color: #fecdd3; background: rgba(255,47,114,.1); }
.tela-conexao .btn-connect { background: var(--brand-gradient); box-shadow: var(--glow); }
.tela-conexao .btn-primary { background: var(--brand-gradient); border-color: var(--brand); }
.tela-conexao .terminal-container { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.tela-conexao .terminal-header { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.tela-conexao pre { margin: 0; padding: 16px; max-height: 500px; overflow: auto; color: var(--ok); font: 12px/1.6 var(--mono); }
.tela-conexao .metric-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.tela-conexao .metric-card, .tela-conexao .mini-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.tela-conexao .metric-label, .tela-conexao .mini-stat .k { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.tela-conexao .metric-value { font-size: 32px; font-weight: 800; line-height: 1.2; }
.tela-conexao .metric-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tela-conexao .mini-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.tela-conexao .mini-stat .v { font-size: 24px; font-weight: 700; }
.tela-conexao .progress-soft { height: 7px; background: var(--surface); border-radius: var(--r-pill); overflow: hidden; }
.tela-conexao .progress-soft > span { display: block; height: 100%; border-radius: inherit; }
.tela-conexao .step-card-modern { display: flex; gap: 14px; padding: 15px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.tela-conexao .step-number { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; background: var(--brand-gradient); font-weight: 700; }
.tela-conexao .info-box-modern { display: flex; gap: 12px; padding: 14px; background: rgba(240,77,47,.08); border-radius: var(--r-md); }
.tela-conexao #qrCanvas, .tela-conexao #qrImageFallback { max-width: 100%; height: auto !important; }
.tela-conexao .cartao-agente { display: none; } /* O status real está em pm2Badge; não presumir agente ativo. */
.tela-conexao :focus-visible, .tela-login :focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
@media (max-width: 1100px) { .tela-conexao .mini-stats { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .login-card { padding: 28px 22px; }
  .tela-conexao .glass { padding: 16px; }
  .tela-conexao .conteudo > .row { row-gap: 20px; }
  .tela-conexao .conexao-resumo > div { flex-wrap: wrap; min-width: 0; }
  .tela-conexao .conexao-resumo .small { overflow-wrap: anywhere; }
  .tela-conexao .metric-grid { grid-template-columns: 1fr; }
  .tela-conexao .btn-action { min-height: 44px; }
}

/* ============================================================
   NOVIDADES
   Linha do tempo de atualizacoes e canal de sugestoes.
   ============================================================ */
.grade-novidades {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 22px;
  align-items: start;
}

.publicacao { margin-bottom: 18px; position: relative; }

.publicacao-nova {
  border-color: rgba(240, 77, 47, .30);
  box-shadow: var(--glow);
}

.publicacao-titulo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.015em;
  margin: 10px 0 6px;
}

.publicacao-resumo {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 18px;
  max-width: 68ch;
}

.item-novidade {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.item-novidade:first-of-type { border-top: 1px solid var(--line); }

.item-titulo { font-size: 13.5px; font-weight: 600; }
.item-detalhe { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* Selo do tipo. Cor diferente por natureza da mudanca, para dar ritmo
   visual a lista sem precisar de icone em cada linha. */
.selo-tipo {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  height: fit-content;
  margin-top: 2px;
  min-width: 74px;
  text-align: center;
}
.selo-novidade { background: rgba(240, 77, 47, .14);  border-color: rgba(240, 77, 47, .32);  color: #ffb199; }
.selo-melhoria { background: rgba(34, 197, 94, .13);  border-color: rgba(34, 197, 94, .30);  color: #86efac; }
.selo-ajuste   { background: rgba(255, 194, 71, .12); border-color: rgba(255, 194, 71, .30); color: #fde68a; }

.enviado {
  border-top: 1px solid rgba(255, 255, 255, .06);
  padding: 11px 0;
}
.enviado:first-of-type { border-top: none; padding-top: 0; }

@media (max-width: 1100px) {
  .grade-novidades { grid-template-columns: 1fr; }
}

/* ============================================================
   AVISO DE NOVIDADE
   Aparece no canto inferior direito quando ha publicacao nao lida.
   ============================================================ */
.aviso-novidade {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 330px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid rgba(240, 77, 47, .30);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55), var(--glow);
  padding: 16px 18px;
  z-index: 70;
  animation: subir-aviso .28s ease;
}

@keyframes subir-aviso {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.aviso-novidade .fechar {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.aviso-novidade .fechar:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

.aviso-novidade .titulo {
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 5px;
  padding-right: 20px;
}
.aviso-novidade .texto {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 14px;
}

@media (max-width: 560px) {
  .aviso-novidade { right: 12px; left: 12px; bottom: 12px; width: auto; }
}
