.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#noteForm select {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid #cad5e3;
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

.material-badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #1d4ed8;
  font-weight: 800;
}

.note-card .source-line {
  margin-bottom: 9px;
  color: #1d4ed8;
  font-weight: 750;
}

.banner-delete {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.18);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 650px) {
  .banner-actions {
    margin-top: 18px;
    flex-wrap: wrap;
  }

  .banner-actions .primary {
    margin-top: 0 !important;
  }
}

.source-file-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.source-file-button {
  margin: 0;
  padding: 13px 8px;
  border: 1px solid #b9c8db;
  border-radius: 11px;
  background: #f7faff;
  color: #1d4ed8;
  text-align: center;
  cursor: pointer;
}

.source-file-button input { display: none; }
.selected-files { display: grid; gap: 7px; margin-top: 9px; color: #64748b; font-size: 12px; }
.selected-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border-radius: 9px; background: #edf3fb; }
.selected-file b,.selected-file small { display: block; }
.selected-thumb { width: 58px; height: 58px; flex: 0 0 58px; object-fit: cover; border-radius: 8px; background: #dbe4f0; }
.selected-file small { margin-top: 3px; }
.file-order { display: flex; gap: 4px; }
.file-order button,.note-path button { padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 7px; background: white; color: #334155; cursor: pointer; }
.file-order button:disabled { opacity: .35; cursor: default; }
.note-path { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -3px 0 10px; padding-bottom: 9px; border-bottom: 1px solid #e2e8f0; color: #475569; font-size: 12px; font-weight: 850; }
.note-path button { color: #be123c; }
.panel-description { margin: 4px 0 0; color: #64748b; font-size: 12px; }
.ai-action { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 15px; }
.ai-action small { color: #64748b; }
.ai-tools { margin-top: 16px; padding: 17px; border: 1px solid #bfdbfe; border-radius: 13px; background: #f5f9ff; }
.ai-tools h4 { margin: 14px 0 5px; }
.ai-tools ul,.ai-tools ol { padding-left: 21px; color: #334155; line-height: 1.55; }
.ai-tools details { margin-top: 14px; }
.ai-tools summary { color: #1d4ed8; font-weight: 850; cursor: pointer; }
.quiz-item { margin-top: 12px; padding-top: 10px; border-top: 1px solid #dbeafe; }
.readability { margin: 10px 0; padding: 12px; border-radius: 10px; }
.readability.readable { background: #ecfdf5; color: #047857; }
.readability.needs-review { background: #fff7ed; color: #c2410c; }
.readability small { display: block; margin-top: 3px; }
.readability ul { margin-bottom: 0; }
.extracted-review { margin: 12px 0; padding: 11px; border: 1px solid #dbeafe; border-radius: 9px; background: white; }
.extracted-review p { white-space: pre-wrap; color: #334155; }
.ask-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid #bfdbfe; }
.ask-note label { margin: 0; }
.ask-note input { background: white; }
.ask-note button { margin-top: 9px; }
.study-answer { margin-top: 12px; padding: 13px; border-radius: 10px; background: white; border-left: 4px solid #2563eb; }
.study-answer p { margin: 7px 0; color: #172033; }
.study-answer small { color: #64748b; }
.attachment-list { display: grid; gap: 9px; }
.chapter-pages { display: flex; overflow-x: auto; gap: 12px; padding: 5px 2px 14px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.chapter-page { flex: 0 0 min(82vw, 420px); margin: 0; scroll-snap-align: start; }
.chapter-page .note-photo { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #eef2f7; }
.chapter-page figcaption { padding: 7px 3px 0; color: #475569; font-size: 12px; font-weight: 800; }
.pdf-file { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 11px; padding: 13px; border: 1px solid #d5dfec; border-radius: 11px; background: #f8fafc; }
.pdf-file span, .pdf-file small { display: block; }
.pdf-file small { margin-top: 3px; color: #64748b; }
.pdf-file a { white-space: nowrap; color: #1d4ed8; font-weight: 800; }
.missing-file { padding: 10px; border-radius: 9px; background: #fff1f2; color: #be123c; }
.photo-fallback { display: grid; gap: 7px; padding: 15px; border: 1px solid #f59e0b; border-radius: 10px; background: #fffbeb; color: #92400e; }
.photo-fallback a { color: #1d4ed8; font-weight: 850; }
.attachment-loading { padding: 12px; border-radius: 9px; background: #eff6ff; color: #1d4ed8; }
.chapter-page figcaption a { color: #1d4ed8; font-weight: 800; }
.debug-panel { position: fixed; right: 12px; bottom: 12px; z-index: 120; width: min(440px, calc(100vw - 24px)); max-height: 55vh; overflow: auto; padding: 12px; border: 1px solid #f59e0b; border-radius: 12px; background: #fffbeb; box-shadow: 0 14px 40px rgba(15,23,42,.2); color: #78350f; font-size: 12px; }
.debug-panel summary { cursor: pointer; font-weight: 900; }
.debug-panel p { margin: 8px 0; }
.debug-status { padding: 9px; border-radius: 8px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.45; }
.debug-actions { display: flex; gap: 7px; margin-top: 8px; }
.debug-actions button { padding: 8px 10px; border: 1px solid #d97706; border-radius: 8px; background: white; color: #92400e; font-weight: 800; }

@media (max-width: 650px) {
  .source-file-actions { grid-template-columns: 1fr; }
  .selected-file { align-items: flex-start; flex-direction: column; }
  .pdf-file { align-items: flex-start; flex-direction: column; }
}
