.nbd-page { max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem 2rem; height: calc(100vh - 60px); display: flex; flex-direction: column; }

.nbd-toolbar {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem;
  .btn-back {
    display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0;
    padding: 0.4rem 0.7rem; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04);
    color: inherit; cursor: pointer; font-size: 0.85rem;
    &:hover { background: rgba(255,255,255,0.09); }
  }
  .nbd-title {
    flex: 1; padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 1.15rem; font-weight: 600;
    border: 1px solid transparent; background: transparent; color: inherit;
    &:hover, &:focus { border-color: rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); outline: none; }
  }
}

.nbd-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 280px 1fr; gap: 1rem;
}

/* Sources */
.nbd-sources {
  display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 0.75rem;
}
.nbd-sources-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  h3 { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.95rem; }
}
.btn-upload {
  display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer;
  padding: 0.3rem 0.55rem; border-radius: 6px; font-size: 0.78rem;
  border: 1px solid rgba(102,126,234,0.4); color: #8ea2ff; background: rgba(102,126,234,0.1);
  &:hover { background: rgba(102,126,234,0.2); }
  &.disabled { opacity: 0.6; cursor: default; }
}
.nbd-upload-error { color: #e88; font-size: 0.8rem; margin: 0.2rem 0; }

.nbd-source {
  display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.5rem;
  border-radius: 7px; background: rgba(255,255,255,0.03);
  lucide-icon.ok { color: #6bd08a; }
  lucide-icon.fail { color: #e88; }
  lucide-icon.busy { color: #e0c074; }
  .nbd-source-info { flex: 1; min-width: 0; }
  .nbd-source-name { font-size: 0.85rem; font-weight: 500; word-break: break-word; }
  .nbd-source-meta { font-size: 0.72rem; color: var(--color-text-muted, #9aa0aa); }
  .nbd-source-del {
    border: none; background: none; color: #e88; cursor: pointer; padding: 0.15rem;
    border-radius: 4px; &:hover { background: rgba(224,90,90,0.15); }
  }
}

/* Chat */
.nbd-chat {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
}
.nbd-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.85rem; }
.nbd-empty { color: var(--color-text-muted, #9aa0aa); font-style: italic; }

.nbd-msg {
  max-width: 88%;
  .nbd-msg-role {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--color-text-muted, #9aa0aa); margin-bottom: 0.2rem;
  }
  .nbd-msg-content { white-space: pre-wrap; line-height: 1.5; }
  &.user { align-self: flex-end; text-align: right;
    .nbd-msg-content { background: rgba(102,126,234,0.16); padding: 0.5rem 0.75rem; border-radius: 10px; display: inline-block; text-align: left; }
  }
  &.assistant { align-self: flex-start;
    .nbd-msg-content { background: rgba(255,255,255,0.04); padding: 0.5rem 0.75rem; border-radius: 10px; }
  }
}
.cursor { opacity: 0.6; }

.nbd-input {
  display: flex; gap: 0.5rem; padding: 0.6rem; border-top: 1px solid rgba(255,255,255,0.08);
  textarea {
    flex: 1; resize: none; padding: 0.55rem 0.7rem; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); color: inherit; font: inherit;
  }
  .btn-send {
    display: inline-flex; align-items: center; justify-content: center; width: 44px;
    border: none; border-radius: 8px; background: #667eea; color: #fff; cursor: pointer;
    &:hover:not(:disabled) { background: #5568d3; }
    &:disabled { opacity: 0.5; cursor: default; }
  }
  .btn-deep {
    display: inline-flex; align-items: center; justify-content: center; width: 44px;
    border: 1px solid rgba(168,130,255,0.4); border-radius: 8px;
    background: rgba(168,130,255,0.12); color: #c4a8ff; cursor: pointer;
    &:hover:not(:disabled) { background: rgba(168,130,255,0.22); }
    &:disabled { opacity: 0.5; cursor: default; }
  }
}

.nbd-deep-progress {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; color: #c4a8ff; font-style: italic;
}

// Pages de la source utilisées par le RAG (transparence de la réponse)
.nbd-msg-sources {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.65;
}
