/* BioSphere · plataforma · estilos do bloco Organização e colaboração (W2).
   Módulos: MOD-14 Parceiros, MOD-16 Administração, MOD-17 Perfil, MOD-21 Importação, MOD-24 Salas, MOD-25 Estúdio de agentes, MOD-26 Bases de conhecimento.
   Só tokens de ds/tokens.css; prefixo de classe org-; escopo pela classe .org da <section> de cada tela ou pelas camadas do bloco (.org-l). */

/* ---------- Estrutura comum ---------- */
.org { gap: var(--space-5); }
.org .bs-tabs.org-tabs { scrollbar-width: none; }
.org .bs-tabs.org-tabs::-webkit-scrollbar { display: none; }
.org-tabs .ap-fase { margin-left: 2px; }
.org-crumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); }
.org-crumb a { color: inherit; text-decoration: none; }
.org-crumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.org-bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.org-bar .bs-search { flex: 1 1 240px; min-width: 0; max-width: 420px; }
.org-bar__sp { flex: 1; }
.org-sec { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.org-sec > h2, .org-h2 { margin: 0; font-weight: 400; font-size: 22px; letter-spacing: -.02em; }
.org-sec > h2 small, .org-h2 small { display: block; margin-top: 4px; font-size: 13px; letter-spacing: 0; color: var(--ink-muted); }
.org-muted { color: var(--ink-muted); }
.org-small { font-size: 12px; color: var(--ink-muted); }
.org-mono { font-family: var(--font-mono); font-size: 12px; }
.org-stack { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.org-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.org-row > .org-grow { flex: 1; min-width: 0; }
.org-card-body { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.org .bs-card__head > .bs-card__title { flex: 1; min-width: 0; }
.org .bs-setting small, .org .bs-row__main small { overflow-wrap: anywhere; }
.org .bs-mc__facts:has(> li:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.org-empty-line { padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 13px; color: var(--ink-muted); }
.org-hide { display: none !important; }
.org .bs-table td .bs-tag + .bs-tag { margin-left: 4px; }
.org .bs-table .cell-main small { display: block; }
.org-num { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.org-dim { opacity: .55; }
.org-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Formulário em grade (modais e passos de assistente) */
.org-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.org-form .org-full { grid-column: 1 / -1; }
.ap-modal .org-form, .ap-drawer .org-form { grid-template-columns: minmax(0, 1fr); }
.ap-modal .org-choice { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-height: 280px; overflow-y: auto; }
.org-wiz { display: flex; flex-direction: column; gap: var(--space-5); }
.org-wiz__foot { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding-top: var(--space-2); }
.org-wiz__foot .org-bar__sp { flex: 1; }
.org .bs-check small, .ap-modal .org-choice .bs-check small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-muted); }
.org-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2); }

/* Índice em grade da Administração (U3 §2.4) */
.org-index { display: grid; grid-template-columns: repeat(auto-fit, minmax(236px, 1fr)); gap: var(--space-4); }
.org-index .bs-card { gap: var(--space-3); }
.org-index .bs-row__side { white-space: nowrap; }

/* Sala: conversa + trilho "O que ficou" (U3 §2.7, forma B) */
.org-sala { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-4); align-items: start; }
.org-chat { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.org-chat .bs-msgs { max-height: 62vh; overflow-y: auto; padding: 4px 2px; scrollbar-width: thin; }
.org-msg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.org-msg--me { align-items: flex-end; }
.org-msg__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); padding: 0 6px; }
.org-msg__acts { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 6px; }
.org-msg .bs-msg { max-width: min(92%, 640px); }
.org-msg--me .bs-msg { background: var(--ink); color: var(--on-ink); }
.org-msg--me .org-msg__meta { justify-content: flex-end; }
.org-trail { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.org-mentions { display: flex; gap: 6px; flex-wrap: wrap; }
.org-orbs { display: inline-flex; align-items: center; }
.org-orbs .bs-orb { width: 22px; height: 22px; margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.org-orbs .bs-orb:first-child { margin-left: 0; }
.org-avs { display: inline-flex; align-items: center; }
.org-avs .bs-avatar { width: 26px; height: 26px; font-size: 10px; margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.org-avs .bs-avatar:first-child { margin-left: 0; }

/* Estúdio de agentes: configuração em 4 seções com prévia ao vivo (U3 §2.6) */
.org-cfg { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: var(--space-5); align-items: start; }
.org-toc { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.org-toc a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-muted); text-decoration: none; }
.org-toc a:hover, .org-toc a.is-on { background: var(--surface-sunken); color: var(--ink); }
.org-toc b { display: block; margin: 12px 12px 4px; font-weight: 500; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.org-toc b:first-child { margin-top: 0; }
.org-cfg__main { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.org-cfg__prev { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.org-anchor { scroll-margin-top: 90px; }
.org-guards { display: flex; flex-direction: column; gap: 6px; }
.org-guard { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: 13px; }
.org-guard .bs-i { flex: none; }
.org-guard span { flex: 1; min-width: 0; }

/* Perfil em 4 seções com índice */
.org-perfil { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.org-notif td, .org-notif th { text-align: center; }
.org-notif td:first-child, .org-notif th:first-child { text-align: left; }

/* Biblioteca e arquivos */
.org-files .bs-file { width: 100%; text-align: left; }
.org-file-row { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.org-file-row .bs-file { flex: 1; min-width: 0; }
.org-file-row .bs-toggle-row { flex: none; width: auto; padding: 6px 10px; gap: 8px; font-size: 12px; }
.org-preview { padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 14px; line-height: 1.6; }
.org-preview mark { background: var(--mint-tint); color: inherit; border-radius: 4px; padding: 0 2px; }

/* Barras simples de proporção (dentro de listas) */
.org-meter { display: flex; align-items: center; gap: 10px; min-width: 0; }
.org-meter .bs-hbar { flex: 1; min-width: 60px; }

/* ---------- Celular e telas estreitas ---------- */
@media (max-width: 1180px) {
  .org-cfg { grid-template-columns: 180px minmax(0, 1fr); }
  .org-cfg__prev { position: static; grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .org-sala { grid-template-columns: minmax(0, 1fr); }
  .org-trail { position: static; }
}
@media (max-width: 900px) {
  .org-cfg, .org-perfil { grid-template-columns: minmax(0, 1fr); }
  .org-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .org-toc b { display: none; }
  .org-toc a { padding: 6px 10px; background: var(--surface-sunken); border-radius: var(--radius-pill); }
  .org-form { grid-template-columns: minmax(0, 1fr); }
  .org-index { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .org .bs-row { flex-wrap: wrap; }
  .org .bs-row__main { flex: 1 1 200px; }
  .org-bar .bs-search { flex-basis: 100%; max-width: none; }
  .org-chat .bs-msgs { max-height: none; }
  .org-file-row { flex-wrap: wrap; }
  .org-file-row .bs-toggle-row { margin-left: auto; }
}
