/* PDF Manager — Combine File page only */
body.pm-app #main-content-area {
  margin-left: var(--app-sidebar-width, 280px);
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
}
body.pm-app .wh-subnav { display: none !important; }
.pm-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.pm-topbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.85rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 20;
}
.pm-title { font-size: 1rem; color: #0f172a; }
.pm-sub { font-size: 0.78rem; color: #64748b; margin-left: 0.5rem; }
.pm-toolbar { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pm-tool {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.pm-tool:hover:not(:disabled) { background: #f8fafc; }
.pm-tool:disabled { opacity: 0.4; cursor: not-allowed; }
.pm-tool.pm-primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.pm-tool.pm-success { background: #15803d; border-color: #15803d; color: #fff; }
.pm-tool.pm-danger { color: #b91c1c; border-color: #fecaca; }
.pm-tool.active { background: #ecfeff; border-color: #14b8a6; color: #0f766e; }
@media (max-width: 1100px) {
  .pm-tool span { display: none; }
}
.pm-alert {
  display: none;
  margin: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}
.pm-alert.show { display: block; }
.pm-alert.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.pm-alert.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.pm-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
}
@media (max-width: 900px) {
  .pm-body { grid-template-columns: 1fr; }
  .pm-rail { max-height: 220px; }
}
.pm-rail {
  border-right: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.pm-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem 0.35rem;
}
.pm-rail-title { font-weight: 700; font-size: 0.85rem; }
.pm-rail #pmSearch { margin: 0 0.75rem 0.45rem; }
.pm-rail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.75rem 0.45rem;
  font-size: 0.78rem;
}
.pm-file-list {
  flex: 1;
  overflow: auto;
  padding: 0 0.4rem 0.75rem;
}
.pm-file-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0.4rem 0.45rem;
  margin-bottom: 0.2rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: #0f172a;
}
.pm-file-item:hover { background: #f1f5f9; }
.pm-file-item.active {
  background: #ecfeff;
  border-color: #99f6e4;
  color: #0f766e;
  font-weight: 650;
}
.pm-file-item.dirty::after {
  content: '•';
  color: #eab308;
  margin-left: auto;
  font-size: 1.1rem;
}
.pm-file-item .idx {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  min-width: 2.2rem;
}
.pm-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.pm-edit-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.45rem 0.75rem;
  background: #0f172a;
  color: #e2e8f0;
}
.pm-edit-bar.d-none { display: none !important; }
.pm-edit-label { font-size: 0.8rem; font-weight: 700; }
.pm-edit-tools, .pm-edit-opts { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.pm-edit-tool {
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
}
.pm-edit-tool.active { background: #14b8a6; border-color: #14b8a6; color: #042f2e; font-weight: 700; }
.pm-stroke { width: 3.5rem; }
#pmTextInput { min-width: 160px; max-width: 280px; }
.pm-viewer {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #cbd5e1;
}
.pm-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: #475569;
  background: #f8fafc;
}
.pm-empty h2 { color: #0f172a; font-size: 1.35rem; }
.pm-scroll {
  height: 100%;
  overflow: auto;
  padding: 1rem 0 3rem;
  scroll-behavior: smooth;
}
.pm-file-block {
  max-width: 900px;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
}
.pm-file-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
  font-weight: 650;
  backdrop-filter: blur(4px);
}
.pm-page {
  position: relative;
  display: inline-block;
  margin: 0 auto 0.85rem;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  border-radius: 4px;
  overflow: hidden;
  max-width: 100%;
}
.pm-page canvas.pm-pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}
.pm-page canvas.pm-anno-canvas {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  cursor: crosshair;
  pointer-events: none;
  background: transparent;
}
.pm-page .pm-hit {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  cursor: crosshair;
  background: transparent;
  pointer-events: none;
}
body.pm-editing .pm-page .pm-hit,
.pm-page.editing .pm-hit {
  pointer-events: auto !important;
  background: rgba(20, 184, 166, 0.06);
  box-shadow: inset 0 0 0 2px rgba(20, 184, 166, 0.55);
}
body.pm-editing .pm-page canvas.pm-anno-canvas,
.pm-page.editing canvas.pm-anno-canvas {
  pointer-events: none !important;
}
.pm-edit-hint {
  display: none;
  width: 100%;
  font-size: 0.78rem;
  color: #99f6e4;
  margin-top: 0.15rem;
}
body.pm-editing .pm-edit-hint { display: block; }
.pm-page-label {
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 0.25rem;
}
.pm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(15, 23, 42, 0.45);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.pm-modal.open { display: flex; }
.pm-modal-dialog {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1.1rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.pm-modal-dialog h3 { font-size: 1.1rem; margin: 0 0 0.35rem; }
@media (max-width: 768px) {
  body.pm-app #main-content-area { margin-left: 0 !important; }
}
