
/* ============================================================================
   NOTAS SUHAI — BIBLIOTECA POR RAMO  (04/09/2026)
   ----------------------------------------------------------------------------
   Escopo: exclusivamente a view #view-notas-suhai. Todas as classes usam o
   prefixo .ns- e todas as cores saem das variáveis do tema — em produção a
   tela fica azul institucional e em beta.sinistroflow.com.br fica verde
   automaticamente, sem nenhuma cor chumbada aqui.
   ========================================================================== */

.ns-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/* ------------------------------------------------------------- sidebar --- */
.ns-sidebar {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .75rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.ns-side-titulo {
  margin: .25rem .5rem .6rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ns-ramo {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .55rem .6rem;
  margin-bottom: .15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: .86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.ns-ramo:hover { background: var(--surface-2); }

.ns-ramo.ativo {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ns-ramo-nome { flex: 1 1 auto; min-width: 0; }

.ns-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  transition: transform var(--transition);
}

.ns-ramo.ativo .ns-chevron { transform: rotate(90deg); }

.ns-ramo-todas .ns-chevron { display: none; }

.ns-count {
  flex: 0 0 auto;
  min-width: 22px;
  padding: .1rem .4rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}

.ns-ramo.ativo .ns-count {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.ns-etapas {
  margin: .1rem 0 .5rem .55rem;
  padding-left: .55rem;
  border-left: 2px solid var(--border);
}

.ns-etapa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  padding: .38rem .5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .8rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.ns-etapa:hover { background: var(--surface-2); color: var(--text); }

.ns-etapa.ativo {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.ns-count-mini {
  flex: 0 0 auto;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- main --- */
.ns-main { min-width: 0; }

.ns-busca-wrap { position: relative; margin-bottom: 1.1rem; }

.ns-busca {
  width: 100%;
  padding: .7rem .9rem .7rem 2.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: .92rem;
  color: var(--text);
}

.ns-busca:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 42, 74, .10);
}

.ns-busca-icone {
  position: absolute;
  left: .8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.ns-header { margin-bottom: 1.1rem; }

.ns-eyebrow {
  margin: 0 0 .25rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ns-h3 {
  margin: 0 0 .35rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.ns-h3-etapa { font-weight: 500; color: var(--text-muted); font-size: 1rem; }

.ns-desc {
  margin: 0 0 .35rem;
  max-width: 62ch;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.ns-total {
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ns-vazio {
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: .92rem;
  text-align: center;
}

/* --------------------------------------------------------------- cards --- */
/* align-items: stretch (padrao do grid) faz os cards da MESMA LINHA ficarem
   com a altura do maior deles. A altura de cada linha continua sendo definida
   pelo conteudo — nao ha altura fixa global. Em uma coluna so (<=1100px) cada
   linha tem um unico card, entao nada e esticado artificialmente. */
#notasSuhaiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.ns-card {
  display: flex;
  flex-direction: column;
  height: 100%;              /* ocupa toda a altura da linha do grid */
  align-self: stretch;       /* reforco explicito, caso algo herde align-items */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem 1.1rem;
}

.ns-trilha {
  margin: 0 0 .4rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ns-card-titulo {
  margin: 0 0 .6rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.ns-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .85rem;
}

.ns-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .18rem .5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.5;
}

.ns-badge-tema {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
}

.ns-badge-pub  { background: var(--success-bg); color: #065f46; }
.ns-badge-conf { background: var(--warning-bg); color: #92400e; }
.ns-badge-flow { background: var(--info-bg);    color: #1e40af; }

.ns-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.ns-card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.ns-bar-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ns-bar-acoes { display: inline-flex; gap: .4rem; }

.ns-btn-ghost,
.ns-btn-copiar {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.ns-btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.ns-btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.ns-btn-copiar {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.ns-btn-copiar:hover { background: var(--primary-light); border-color: var(--primary-light); }

.ns-btn-copiar.ns-copiado {
  background: var(--success);
  border-color: var(--success);
}

.ns-btn-ghost svg,
.ns-btn-copiar svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* ------------------------------------------------- conteúdo da nota ------ */
.ns-nota {
  flex: 1 1 auto;            /* absorve a sobra quando o card e esticado */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.ns-editavel {
  padding: .7rem .8rem;
  font-family: inherit;
  font-size: .86rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.ns-editavel:focus {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--primary);
  border-radius: var(--radius-sm);
}

.ns-assunto {
  font-weight: 700;
  border-bottom: 1px dashed var(--border);
}

/* Campos que o analista precisa preencher antes de copiar. */
.ns-campo {
  background: var(--warning-bg);
  color: #92400e;
  border-bottom: 1px dashed var(--warning);
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 700;
}

.ns-opcional {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  margin-top: .7rem;
  font-size: .78rem;
  color: var(--text-muted);
  cursor: pointer;
}

.ns-opcional input { margin-top: .15rem; accent-color: var(--primary); }

.ns-bloco-op {
  margin-top: .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

/* margin-top:auto prende a observacao ao rodape do card. Assim, em uma linha
   onde um card tem observacao e o outro nao, os dois terminam alinhados e a
   caixa cinza da nota cresce ate encostar no rodape. */
.ns-obs {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  margin: .75rem 0 0;
  margin-top: auto;
  padding-top: .75rem;
  font-size: .76rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.ns-obs svg { width: 13px; height: 13px; flex: 0 0 auto; margin-top: .15rem; }

/* -------------------------------------------------------------- legenda -- */
.ns-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
  font-size: .76rem;
  color: var(--text-muted);
}

.ns-legenda span { display: inline-flex; align-items: center; gap: .35rem; }

.ns-leg-quad {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.ns-leg-pub   { background: var(--success-bg); border: 1px solid var(--success); }
.ns-leg-conf  { background: var(--warning-bg); border: 1px solid var(--warning); }
.ns-leg-flow  { background: var(--info-bg);    border: 1px solid var(--info); }
.ns-leg-campo { background: var(--warning-bg); border: 1px dashed var(--warning); }

/* ---------------------------------------------------------- responsivo --- */
@media (max-width: 1100px) {
  #notasSuhaiGrid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .ns-layout { grid-template-columns: 1fr; }
  .ns-sidebar { position: static; max-height: none; }
}
