/* Project Materials (项目资料) Dialog, Topbar Pill & Live Reading Progress Strip */
.pm-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(139, 94, 59, 0.28);
  background: linear-gradient(135deg, #fffdf9 0%, #f6efe4 100%);
  color: #4a3525;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(90, 62, 40, 0.06);
}
.pm-topbar-btn:hover {
  border-color: #8b5e3b;
  background: #f3e8d8;
  transform: translateY(-1px);
}
.pm-topbar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e6d7c3;
  color: #5a3e28;
}
.pm-topbar-badge.has-read {
  background: #d4edda;
  color: #1e5e32;
}
.pm-topbar-badge.has-error {
  background: #fde2dd;
  color: #9e2a1c;
}

.pm-live-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px 0;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 251, 245, 0.92);
  border: 1px solid rgba(145, 106, 74, 0.22);
  font-size: 12.5px;
  color: #4f3a2a;
}
.pm-live-strip.hidden {
  display: none !important;
}
.pm-live-strip-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pm-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.pm-live-pill.reading {
  background: #fff3cd;
  color: #856404;
  animation: pmPulse 1.4s infinite ease-in-out;
}
.pm-live-pill.read {
  background: #dcf5e3;
  color: #1b6332;
}
.pm-live-pill.catalog {
  background: #eee7dc;
  color: #5c4738;
}
.pm-live-pill.error {
  background: #fde2dd;
  color: #9e2a1c;
}
.pm-live-pill.skipped {
  background: #ebe5f5;
  color: #4d3575;
}
@keyframes pmPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.pm-dialog {
  width: min(860px, 94vw);
  max-height: 88vh;
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid rgba(139, 94, 59, 0.28);
  background: #fbf8f3;
  color: #36261b;
  box-shadow: 0 24px 60px rgba(45, 30, 18, 0.24);
}
.pm-dialog::backdrop {
  background: rgba(32, 22, 14, 0.42);
  backdrop-filter: blur(3px);
}
.pm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.pm-head h2 {
  margin: 2px 0 4px 0;
  font-size: 20px;
}
.pm-head p {
  margin: 0;
  font-size: 13px;
  color: #6e5644;
}
.pm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #f3ece1;
  margin-bottom: 12px;
}
.pm-toolbar button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(120, 84, 56, 0.28);
  background: #fffdf9;
  color: #3f2d20;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.pm-toolbar button.primary {
  background: #7c5234;
  color: #fff;
  border-color: #7c5234;
}
.pm-cloud-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: #523d2d;
  cursor: pointer;
}
.pm-cloud-toggle input {
  width: auto;
  margin: 0;
}

.pm-folder-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 12.5px;
}
.pm-folder-banner[hidden],
.pm-folder-banner.hidden {
  display: none !important;
}
.pm-folder-banner.connected {
  background: #e8f5ec;
  border: 1px solid #b6dfc3;
  color: #1f5730;
}
.pm-folder-banner.warning {
  background: #fff4df;
  border: 1px solid #f0cb85;
  color: #7a4f08;
}
.pm-folder-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pm-folder-banner-actions button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(100, 70, 40, 0.3);
  background: #fff;
  color: #3f2d20;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pm-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.pm-status-msg {
  margin: 6px 0 10px 0;
  font-size: 12.5px;
  color: #6b4c35;
  min-height: 18px;
}

.pm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}
.pm-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(139, 94, 59, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pm-card[data-read-status="read"] {
  border-left: 4px solid #2b8a44;
}
.pm-card[data-read-status="cataloged"] {
  border-left: 4px solid #b88b58;
}
.pm-card[data-read-status="error"],
.pm-card[data-read-status="local_only"] {
  border-left: 4px solid #c94a38;
  background: #fffaf9;
}
.pm-card[data-read-status="skipped"] {
  border-left: 4px solid #6e5494;
  background: #faf8fc;
}
.pm-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pm-card-title {
  font-weight: 700;
  font-size: 14px;
  color: #2f2016;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pm-card-actions button {
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(120, 84, 56, 0.26);
  background: #f9f4ec;
  color: #463224;
  font-size: 11.5px;
  cursor: pointer;
}
.pm-card-actions button:hover {
  background: #ede2d2;
}
.pm-card-meta {
  font-size: 12px;
  color: #5b4636;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pm-card-reason {
  font-size: 12px;
  color: #a12c1f;
  background: #fdece9;
  padding: 4px 8px;
  border-radius: 6px;
}
.pm-card-skipped-reason {
  font-size: 12px;
  color: #51397a;
  background: #efeaf7;
  padding: 4px 8px;
  border-radius: 6px;
}
.pm-card details {
  font-size: 12px;
  color: #4e3b2c;
}
.pm-card details pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  background: #f6f1e9;
  padding: 8px 10px;
  border-radius: 8px;
  margin-top: 6px;
  font-size: 12px;
}
.pm-retry-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.pm-retry-box input {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(120, 84, 56, 0.3);
}
