/* ============================================================
   comites-hub.css — Hub de Assembleia Geral & Comitês.
   Cabeçalho da entidade + switch (Conversas/Tarefas) + trilho
   lateral próprio + painel que reusa as áreas de chat e tarefas.
   Sobre tokens + app + chat + tarefas.
   ============================================================ */

.hub {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 128px);
  min-height: 520px;
}
body[data-density="compacta"] .hub { height: calc(100vh - 112px); }

/* ── Cabeçalho da entidade ── */
.hub-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.hub-head-ic {
  width: 48px; height: 48px; flex: none;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.hub-head-tx { flex: 1; min-width: 0; }
.hub-head-tx h1 {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-h3);
  color: var(--color-text);
  line-height: 1.1;
  margin: 0;
}
.hub-head-tx p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 3px 0 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Switch Conversas / Tarefas ── */
.hub-switch {
  flex: none;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--stone-100);
  border-radius: var(--radius-pill);
}
.hub-switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.hub-switch button:hover { color: var(--color-text); }
.hub-switch button.active {
  background: var(--color-surface);
  color: var(--green-800);
  box-shadow: var(--shadow-xs);
}
.hub-switch-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--green-600); color: #fff;
  font-family: var(--font-heading); font-weight: 800; font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.hub-switch-badge.is-soft { background: var(--stone-300); color: var(--color-text); }
.hub-switch button.active .hub-switch-badge.is-soft { background: var(--green-100); color: var(--green-800); }

/* ── Corpo: trilho + painel ── */
.hub-body { flex: 1; min-height: 0; }
.hub-split {
  display: flex;
  height: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

/* trilho lateral (canais ou quadros) */
.hub-rail {
  width: 256px; flex: none;
  display: flex; flex-direction: column;
  background: var(--stone-50);
  border-right: 1px solid var(--color-border);
  min-width: 0;
}
.hub-rail-top {
  flex: none;
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.hub-rail-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-heading); font-weight: 800;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-muted);
}
.hub-rail-kicker svg { color: var(--green-700); }
.hub-rail-search {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0.45rem var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
}
.hub-rail-search:focus-within { border-color: var(--green-400); box-shadow: 0 0 0 3px var(--green-50); }
.hub-rail-search input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font-family: var(--font-body); font-size: var(--text-sm); color: var(--color-text);
}
.hub-rail-search input:focus, .hub-rail-search input:focus-visible { box-shadow: none; outline: none; }

.hub-rail-scroll { flex: 1; overflow-y: auto; padding: var(--space-3) var(--space-2); scrollbar-width: thin; }
.hub-rail-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: var(--space-3); }
.hub-rail-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: var(--space-2) var(--space-2) var(--space-1);
  font-family: var(--font-heading); font-weight: 700;
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--color-text-faint);
}
.hub-rail-label.is-meus { color: var(--green-700); }
.hub-rail-label svg { opacity: .8; }
.hub-rail-empty { font-size: var(--text-sm); color: var(--color-text-faint); padding: var(--space-3) var(--space-3); }

/* item de canal/quadro no trilho */
.hub-chan {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 0.5rem var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-family: var(--font-body); font-size: var(--text-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.hub-chan:hover { background: var(--stone-100); color: var(--color-text); }
.hub-chan.active { background: var(--green-700); color: #fff; font-weight: 600; }
.hub-chan.active .hub-chan-ic, .hub-chan.active .hub-quadro-ic svg { opacity: 1; }
.hub-chan.unread:not(.active) { color: var(--color-text); font-weight: 600; }
.hub-chan-ic { flex: none; display: inline-flex; opacity: .7; }
.hub-chan-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-chan-pin { flex: none; display: inline-flex; color: var(--green-600); opacity: .85; }
.hub-chan.active .hub-chan-pin { color: var(--lime-300); }
.hub-chan-badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--green-600); color: #fff;
  font-family: var(--font-heading); font-weight: 800; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.hub-chan-badge.is-soft { background: var(--stone-200); color: var(--color-text-muted); }
.hub-chan.active .hub-chan-badge { background: var(--lime-300); color: var(--green-900); }
.hub-chan.active .hub-chan-badge.is-soft { background: color-mix(in srgb, #fff 26%, transparent); color: #fff; }
.hub-quadro-ic {
  flex: none; width: 22px; height: 22px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.hub-mine { color: var(--color-text); font-weight: 600; }

/* painel principal (chat ou tarefas) */
.hub-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--color-surface); }
.hub-pane-scroll { overflow-y: auto; padding: var(--space-5); scrollbar-width: thin; }

/* o ChatCenter, embutido, perde sua moldura própria e preenche o painel */
.hub-pane .chat { height: 100%; min-height: 0; border: none; border-radius: 0; box-shadow: none; }
/* o TaskCenter já é block; só garante largura plena */
.hub-pane-scroll .tk { min-width: 0; }

/* estado vazio */
.hub-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--space-2); padding: var(--space-8);
}
.hub-empty-ic {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--green-100); color: var(--green-700);
  display: flex; align-items: center; justify-content: center;
}
.hub-empty strong { font-family: var(--font-heading); font-weight: 700; font-size: var(--text-lg); color: var(--color-text); }
.hub-empty span { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 340px; }

/* ── responsivo ── */
@container portal (max-width: 860px) {
  .hub-head { flex-wrap: wrap; }
  .hub-switch { order: 3; width: 100%; justify-content: stretch; }
  .hub-switch button { flex: 1; justify-content: center; }
}
@container portal (max-width: 760px) {
  .hub { height: auto; min-height: 0; }
  .hub-body { min-height: 70vh; }
  .hub-split { flex-direction: column; height: auto; }
  .hub-rail { width: auto; border-right: none; border-bottom: 1px solid var(--color-border); }
  .hub-rail-scroll { max-height: 220px; }
  .hub-pane .chat { height: auto; min-height: 60vh; }
}

/* ============================================================
   CELULAR — experiência de conversa estilo mensageiro.
   Lista de canais (full) → tocar → conversa em tela cheia com
   barra de topo contextual que substitui a barra padrão do app.
   ============================================================ */

/* ── Lista de canais ocupa a área toda (sem painel de chat ao lado) ── */
.hub-phone-list .hub-split { display: block; height: auto; border: none; border-radius: 0; box-shadow: none; background: transparent; }
.hub-phone-list .hub-rail-list {
  width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface); overflow: hidden; box-shadow: var(--shadow-sm);
}
.hub-phone-list .hub-rail-scroll { max-height: none; padding: var(--space-2); }
.hub-rail-hint { font-size: var(--text-xs); color: var(--color-text-faint); margin: 2px 0 0; }

/* linha de conversa (WhatsApp-like) */
.hub-conv-row {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 0.7rem var(--space-3); border-radius: var(--radius-md);
}
.hub-conv-row:hover, .hub-conv-row:active { background: var(--stone-100); }
.hub-conv-av {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-700); color: #fff;
}
.hub-conv-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hub-conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.hub-conv-top strong { font-family: var(--font-heading); font-weight: 700; font-size: var(--text-base); color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-conv-time { flex: none; font-size: 11px; color: var(--color-text-faint); }
.hub-conv-sub { font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-conv-row.unread .hub-conv-top strong { color: var(--color-text); }
.hub-conv-row.unread .hub-conv-sub { color: var(--color-text); font-weight: 600; }
.hub-conv-row.unread .hub-conv-time { color: var(--green-700); font-weight: 700; }
.hub-conv-badge { align-self: center; }

/* ── Conversa imersiva (tela cheia) ── */
body.mdn-chat-immersive .app-topbar { display: none; }
body.mdn-chat-immersive .app-content { padding: 0; display: flex; flex-direction: column; }
body.mdn-chat-immersive .app-grave-bar { display: none; }

.hub-immersive {
  height: auto; min-height: 0; flex: 1;
  display: flex; flex-direction: column; min-width: 0;
}
.hub-im-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--color-surface); }
.hub-im-pane .chat { height: 100%; min-height: 0; border: none; border-radius: 0; box-shadow: none; }
/* minimalismo: a barra contextual já mostra o canal — o cabeçalho interno do chat some */
.hub-immersive .chat-head { display: none; }

/* barra de topo contextual */
.hub-ctx { flex: none; position: relative; z-index: 6; }
.hub-ctx-bar {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--green-900); color: var(--stone-50);
  padding: var(--space-3);
}
.root-app.phone .hub-ctx-bar { padding-top: calc(34px + var(--space-3)); }
.hub-ctx-back {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: none; cursor: pointer; color: var(--stone-50);
  display: inline-flex; align-items: center; justify-content: center;
}
.hub-ctx-back:hover, .hub-ctx-back:active { background: color-mix(in srgb, var(--stone-50) 12%, transparent); }
.hub-ctx-card {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-3);
  background: none; border: none; cursor: pointer; color: var(--stone-50);
  padding: 4px 6px; border-radius: var(--radius-md); text-align: left;
}
.hub-ctx-card:hover, .hub-ctx-card:active { background: color-mix(in srgb, var(--stone-50) 10%, transparent); }
.hub-ctx-av {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--lime-300) 24%, transparent); color: var(--lime-300);
}
.hub-ctx-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hub-ctx-tx strong { font-family: var(--font-heading); font-weight: 700; font-size: var(--text-base); color: var(--stone-50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.hub-ctx-tx span { font-size: 11px; color: color-mix(in srgb, var(--stone-50) 64%, transparent); display: inline-flex; align-items: center; gap: 5px; }
.hub-ctx-caret { flex: none; color: color-mix(in srgb, var(--stone-50) 60%, transparent); transition: transform var(--dur-fast); }
.hub-ctx-caret.up { transform: rotate(180deg); }

/* menu "trocar de canal" */
.hub-ctx-scrim { position: fixed; inset: 0; z-index: 7; background: color-mix(in srgb, #000 28%, transparent); }
.hub-ctx-menu {
  position: absolute; left: var(--space-3); right: var(--space-3); top: calc(100% - 4px); z-index: 8;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: var(--space-2); max-height: 60vh; overflow-y: auto;
}
.hub-ctx-menu-label {
  display: block; padding: var(--space-2) var(--space-3) var(--space-1);
  font-family: var(--font-heading); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-faint);
}
.hub-ctx-item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 0.6rem var(--space-3);
  border-radius: var(--radius-md); color: var(--color-text); font-size: var(--text-sm);
}
.hub-ctx-item:hover, .hub-ctx-item:active { background: var(--stone-100); }
.hub-ctx-item.active { background: var(--green-50); color: var(--green-800); font-weight: 600; }
.hub-ctx-item-ic { flex: none; display: inline-flex; color: var(--color-text-muted); }
.hub-ctx-item.active .hub-ctx-item-ic { color: var(--green-700); }
.hub-ctx-item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-ctx-item svg:last-child { color: var(--green-700); flex: none; }

