/* Sidebar recolhível (estilo Claude): fixa à esquerda; recolhida vira uma faixa só de ícones.
   No celular vira gaveta por cima da tela, aberta pelo botão de menu do topo. */

:root { --sb-w: 264px; --sb-w-recolhida: 56px; }

body { padding-left: var(--sb-w); transition: padding-left .18s ease; }
body.sb-recolhida { padding-left: var(--sb-w-recolhida); }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--sb-w);
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 10px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width .18s ease, transform .18s ease;
  overflow: hidden;
}
.sidebar.recolhida { width: var(--sb-w-recolhida); padding: 12px 8px; }

.sb-topo { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 2px 0 8px; }
.sb-titulo { font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.sb-alternar {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.sb-alternar:hover { background: var(--bg); color: var(--text); }
.sb-alternar svg { width: 18px; height: 18px; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); text-align: left; cursor: pointer; white-space: nowrap;
}
a.sb-item { text-decoration: none; }
.sb-item:hover { background: var(--bg); }
.sb-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sb-item svg { width: 18px; height: 18px; flex: none; }
.sb-rotulo { overflow: hidden; text-overflow: ellipsis; }

.sb-selo-aprov { background: var(--e-aguardando-l); }
.sb-selo {
  margin-left: auto; min-width: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--wpp); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}

.sb-secao { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; margin-top: 10px; }
.sb-secao-cabeca { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 10px; }
.sb-secao-titulo { color: var(--muted); font-size: 12px; font-weight: 600; }
.sb-menu-box { position: relative; }
.sb-mais {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.sb-mais:hover, .sb-mais[aria-expanded="true"] { background: var(--bg); color: var(--text); }
.sb-mais svg { width: 16px; height: 16px; }
.sb-menu-pop {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 5;
  min-width: 180px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgb(0 0 0 / .14);
}
.sb-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; white-space: nowrap;
}
.sb-menu-item:hover { background: var(--bg); }
.sb-menu-item svg { width: 16px; height: 16px; color: var(--muted); }

/* item "Conversas" da navegação: só com a barra recolhida */
.sidebar:not(.recolhida) .sb-so-recolhida { display: none; }
.sb-busca { height: 34px; }
.sb-lista { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.sb-vazio { margin: 8px 10px; color: var(--faint); font-size: 12.5px; }

.sb-conversa {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; text-align: left; cursor: pointer;
}
.sb-conversa:hover { background: var(--bg); }
.sb-conversa.on { background: var(--accent-soft); }
.sb-conversa .avatar { width: 34px; height: 34px; }
.avatar-grupo { background: var(--line-strong); color: var(--muted); }
.avatar-grupo svg { width: 17px; height: 17px; }
.sb-c-meio { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-c-linha { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sb-c-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13.5px; }
.sb-conversa.nova .sb-c-nome { font-weight: 700; }
.sb-c-linha small { color: var(--faint); font-size: 11px; flex: none; }
.sb-conversa.nova .sb-c-linha small { color: var(--wpp); font-weight: 600; }
.sb-c-previa { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.sb-mudo { display: grid; color: var(--faint); }
.sb-mudo svg { width: 13px; height: 13px; }
.sb-n {
  flex: none; min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--wpp); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
}
.sb-n.mudo { background: var(--faint); }

/* recolhida: só ícones; o número de não lidas vira uma bolinha no ícone de conversas */
.sidebar.recolhida .sb-titulo,
.sidebar.recolhida .sb-rotulo,
.sidebar.recolhida .sb-secao { display: none; }
.sidebar.recolhida .sb-topo { justify-content: center; padding: 0; }
.sidebar.recolhida .sb-item { justify-content: center; padding: 0; }
.sidebar.recolhida .sb-selo {
  position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; line-height: 16px; font-size: 9.5px;
}

/* botão de menu do topo e fundo escuro: só no celular */
.sb-menu { display: none; }
.sb-fundo { display: none; }

@media (max-width: 900px) {
  body, body.sb-recolhida { padding-left: 0; }
  .sidebar, .sidebar.recolhida { width: min(300px, 86vw); padding: 12px 10px; transform: translateX(-100%); z-index: 50; }
  .sidebar.recolhida .sb-titulo, .sidebar.recolhida .sb-rotulo { display: inline; }
  .sidebar.recolhida .sb-secao { display: flex; }
  .sidebar.recolhida .sb-topo { justify-content: space-between; padding: 0 2px 0 8px; }
  .sidebar.recolhida .sb-item { justify-content: flex-start; padding: 0 10px; }
  .sidebar.recolhida .sb-selo { position: static; }
  .sidebar.recolhida .sb-so-recolhida { display: none; }
  body.sb-mobile-aberta .sidebar { transform: none; box-shadow: 12px 0 32px rgb(0 0 0 / .18); }
  body.sb-mobile-aberta .sb-fundo { display: block; position: fixed; inset: 0; z-index: 49; background: rgb(0 0 0 / .3); }
  .sb-menu { display: grid; }
}
