[hidden] {
  display: none !important;
}

/* ========== Shared upload modal shell ========== */

.dashboard-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}

.dashboard-modal {
  position: relative;
  z-index: 10000;
  width: min(90vw, 800px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.dashboard-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.dashboard-modal-body {
  padding: 24px;
}

.dashboard-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
}

/* ========== Upload modal / document uploader ========== */

.upload-modal-shell {
  width: min(90vw, 800px);
}

.document-uploader {
  font-family: inherit;
}

.upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  background-color: #f9f9f9;
  transition: border-color 0.3s;
}

.upload-section:hover {
  border-color: #4caf50;
}

.file-input {
  display: none;
}

.upload-btn {
  padding: 10px 20px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.upload-btn:hover {
  background-color: #45a049;
}

.upload-hint {
  margin-top: 12px;
  color: #666;
  text-align: center;
  font-size: 14px;
}

.processing {
  margin: 20px 0;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 16px;
  background-color: #eee;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background-color: #4caf50;
  transition: width 0.3s ease;
}

.document-preview {
  margin-top: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.preview-header h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.page-count {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  background-color: #fafafa;
}

.preview-item {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px;
  background-color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: grab;
}

.preview-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.preview-item:active {
  cursor: grabbing;
}

.preview-item img {
  width: 100%;
  max-height: 110px;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  display: block;
}

.page-number {
  text-align: center;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.document-options {
  margin-top: 20px;
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.action-bar {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
}

.reset-btn {
  padding: 8px 14px;
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.reset-btn:hover {
  background-color: #e9e9e9;
}

.verify-btn {
  padding: 8px 20px;
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s;
}

.verify-btn:hover {
  background-color: #0b7dda;
}

.verify-btn:disabled {
  background-color: #b0bec5;
  cursor: not-allowed;
}

@media (max-width: 500px) {
  .dashboard-modal-backdrop {
    padding: 12px;
    align-items: center;
  }

  .dashboard-modal {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .dashboard-modal-header,
  .dashboard-modal-body {
    padding: 16px;
  }

  .preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    max-height: 180px;
  }

  .preview-item img {
    max-height: 88px;
  }

  .action-bar {
    flex-direction: column;
  }

  .action-bar button {
    width: 100%;
  }
}

.page-badges {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.page-badge {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 22px;
}

.page-badge-original {
  background: #f3f4f6;
  color: #9ca3af;
  border: 1px solid #e5e7eb;
  opacity: 0.75;
}

.page-badge-current {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.page-number {
  display: none;
}