.fb-panel {
  display: flex;
  flex-direction: column;
  flex: 1;       /* fill remaining space after the tab bar */
  min-height: 0; /* allow the flex child to shrink below its content size */
  overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────── */
.fb-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.fb-toolbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.fb-toolbar-btn:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.fb-toolbar-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.fb-toolbar-btn--clear:hover:not(:disabled) {
  color: #e07070;
  border-color: rgba(200, 60, 60, 0.5);
}

/* ── Empty state ─────────────────────────────────────── */
.fb-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-serif);
  font-style: italic;
  text-align: center;
  line-height: 1.65;
  gap: 2px;
}

.fb-empty p {
  margin: 0;
}

/* ── Card list ───────────────────────────────────────── */
.fb-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Individual card ─────────────────────────────────── */
.fb-card {
  flex-shrink: 0; /* never compress — let the list scroll instead */
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--message-bg);
}

.fb-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.12s;
}

.fb-card-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.fb-card-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fb-card-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}

.fb-card:hover .fb-card-dismiss {
  opacity: 1;
}

.fb-card-dismiss:hover {
  color: var(--text-primary);
}

/* Wrapper that holds the type badge + optional source tag side by side */
.fb-card-header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Coloured type badge */
.fb-card-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--badge-color, var(--accent));
  /* Soft tint background using the badge colour */
  background: color-mix(in srgb, var(--badge-color, var(--accent)) 15%, transparent);
  border-radius: 3px;
  padding: 2px 6px;
  align-self: flex-start;
}

/* Small label shown on attachment-driven (custom) annotations */
.fb-card-source-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(30, 200, 150, 0.75);
  border: 1px solid rgba(30, 200, 150, 0.3);
  border-radius: 3px;
  padding: 1px 5px;
  align-self: flex-start;
  white-space: nowrap;
}

/* Passage excerpt — wraps so the full text is always visible */
.fb-card-excerpt {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  min-width: 0;
}

/* ── Analyse button (idle state) ─────────────────────── */
.fb-card-analyse-btn {
  display: block;
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.fb-card-analyse-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ── Loading dots ────────────────────────────────────── */
.fb-card-loading {
  display: flex;
  gap: 4px;
  padding: 8px 10px 10px;
  align-items: center;
}

.fb-card-loading span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s ease-in-out infinite;
}

.fb-card-loading span:nth-child(2) { animation-delay: 0.2s; }
.fb-card-loading span:nth-child(3) { animation-delay: 0.4s; }

/* ── Analysis body (markdown) ────────────────────────── */
.fb-card-analysis {
  padding: 4px 10px 8px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

/* Shrink Chat.css markdown styles for the smaller card context */
.fb-card-analysis p {
  margin: 0 0 8px;
}

.fb-card-analysis p:last-child {
  margin-bottom: 0;
}

.fb-card-analysis blockquote {
  border-left: 3px solid var(--accent);
  margin: 6px 0;
  padding: 2px 8px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── Apply suggestion button ─────────────────────────── */
.fb-card-apply {
  display: block;
  width: calc(100% - 20px);
  margin: 4px 10px 10px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #1a1208;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.fb-card-apply:hover {
  opacity: 0.85;
}

/* ── Archive section ─────────────────────────────────── */
.fb-archive {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.fb-archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}

.fb-archive-header::-webkit-details-marker { display: none; }

.fb-archive-header:hover {
  color: var(--text-secondary);
}

.fb-archive-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fb-archive-count {
  background: var(--border);
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  letter-spacing: 0;
}

.fb-archive-clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.fb-archive-clear-btn:hover {
  color: #e07070;
  border-color: rgba(200, 60, 60, 0.5);
}

.fb-archive-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 12px 10px;
  max-height: 260px;
  overflow-y: auto;
}

/* ── Archive card ────────────────────────────────────── */
.fb-archive-card {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px;
  background: var(--message-bg);
  opacity: 0.7;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fb-archive-card:hover {
  opacity: 1;
}

.fb-archive-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fb-archive-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* "applied" / "dismissed" status tag */
.fb-archive-status {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  align-self: flex-start;
}

.fb-archive-status--applied {
  color: rgba(80, 200, 120, 0.85);
  border: 1px solid rgba(80, 200, 120, 0.3);
}

.fb-archive-status--dismissed {
  color: rgba(160, 160, 160, 0.75);
  border: 1px solid rgba(160, 160, 160, 0.25);
}

.fb-archive-card-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}

.fb-archive-card:hover .fb-archive-card-dismiss {
  opacity: 1;
}

.fb-archive-card-dismiss:hover {
  color: var(--text-primary);
}

.fb-archive-card-excerpt {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

.fb-archive-card-suggestion {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── User comment card body ──────────────────────────── */
.fb-card-user-comment-body {
  padding: 4px 10px 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-primary);
  font-family: var(--font-sans);
  white-space: pre-wrap;
  word-break: break-word;
}

.fb-archive-card-comment {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Add document note ───────────────────────────────── */
.fb-add-note-section {
  flex-shrink: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.fb-add-note-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  width: 100%;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.fb-add-note-btn:hover {
  color: rgba(80, 180, 240, 0.9);
  border-color: rgba(80, 180, 240, 0.4);
}

.fb-note-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fb-note-textarea {
  width: 100%;
  background: var(--message-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 6px 8px;
  resize: none;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.fb-note-textarea:focus {
  border-color: rgba(80, 180, 240, 0.5);
}

.fb-note-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.fb-note-form-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.fb-note-save-btn {
  background: rgba(80, 180, 240, 0.15);
  border: 1px solid rgba(80, 180, 240, 0.4);
  border-radius: 4px;
  color: rgba(80, 180, 240, 0.9);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.fb-note-save-btn:hover {
  background: rgba(80, 180, 240, 0.25);
}

.fb-note-cancel-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.15s;
}

.fb-note-cancel-btn:hover {
  color: var(--text-primary);
}

/* ── Document note card: no hover jump affordance ───── */
.fb-card-header--no-jump {
  cursor: default;
}

.fb-card-header--no-jump:hover {
  background: transparent;
}
