/* PDF.js text layer */
.attachment-pdf-page-wrap {
  position: relative;
  margin: 0 auto 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  background: #fff;
}
.attachment-pdf-page-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}
.attachment-pdf-page-wrap .textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  user-select: text;
}
.attachment-pdf-page-wrap .textLayer span {
  position: absolute;
  white-space: pre;
  transform-origin: 0 0;
  color: transparent;
}
.attachment-pdf-page-wrap .textLayer ::selection {
  background: rgba(37, 99, 235, 0.35);
}

.attachment-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0f172a;
  display: flex;
  flex-direction: column;
}
.attachment-viewer.hidden { display: none !important; }
.attachment-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.85rem;
  background: #1e293b;
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}
.attachment-viewer-toolbar .title {
  font-weight: 600;
  margin-right: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-viewer-status {
  font-size: 0.85rem;
  color: #94a3b8;
  white-space: nowrap;
  min-width: 4.5rem;
  text-align: right;
}
.attachment-viewer-status.saving {
  color: #93c5fd;
}
.attachment-viewer-status.saved {
  color: #86efac;
}
.attachment-viewer-status.error {
  color: #fca5a5;
}
.attachment-viewer-toolbar .attachment-viewer-delete {
  color: #fca5a5;
}
.attachment-viewer-toolbar .attachment-viewer-delete:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
}
.attachment-viewer-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  min-height: 0;
}
.attachment-viewer-doc {
  background: #525659;
  overflow: auto;
  padding: 1rem;
  min-width: 0;
}
.attachment-viewer-doc iframe,
.attachment-viewer-doc img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}
.attachment-viewer-doc iframe {
  width: 100%;
  min-height: 80vh;
  border: none;
  background: #fff;
}
.attachment-viewer-doc pre {
  background: #fff;
  color: #0f172a;
  padding: 1rem;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 900px;
  margin: 0 auto;
}
.attachment-viewer-findings {
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-left: 1px solid #334155;
}
.attachment-viewer-notes-header {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  background: #f8fafc;
  flex-shrink: 0;
}
.attachment-viewer-notes-toolbar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fafafa;
  flex-shrink: 0;
}
.attachment-viewer-findings-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  min-height: 0;
}
.attachment-viewer-findings-body > .findings-table-sticky-head {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.attachment-viewer-findings-body > .findings-table-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
}
.attachment-viewer-findings-body .findings-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 0.5rem 0.75rem 1rem;
}
.attachment-viewer-findings-body .findings-table {
  width: 100%;
}
.attachment-viewer-notes-toolbar select {
  font: inherit;
  padding: 0.3rem 0.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.attachment-viewer-empty {
  color: #cbd5e1;
  padding: 2rem;
  text-align: center;
}
.attachment-viewer-download {
  color: #93c5fd;
}

.attachments-panel .attachment-item {
  display: grid;
  gap: 0.35rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #e2e8f0;
}
.attachments-panel .attachment-meta {
  font-size: 0.85rem;
  color: #64748b;
}
.attachments-panel .attachment-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.attachments-only-panel {
  position: relative;
}
.attachments-only-panel.is-uploading-blocking .attachments-panel {
  opacity: 0.55;
  pointer-events: none;
}
.attachment-upload-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  min-height: 6rem;
}
.attachment-upload-message {
  margin: 0;
  font-size: 0.9rem;
  color: #334155;
  font-weight: 500;
  text-align: center;
  padding: 0 1rem;
}
.attachments-panel .btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.attachment-upload-progress {
  flex: 1 1 100%;
  min-width: 12rem;
}
.attachment-upload-progress-track {
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.attachment-upload-progress-fill {
  height: 100%;
  width: 0;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.2s ease;
}
.attachment-upload-progress-message {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}
.attachment-upload-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}
