:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* Section Blocks */
.section-block {
  margin-bottom: 2.5rem;
}

.section-main-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfc;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 1.25rem;
}

/* Registry Grid - Equal sizing */
.registry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .registry-grid {
    grid-template-columns: 1fr;
  }
}

/* Status Badge in Header */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  background: var(--bg-body);
  border-radius: 9999px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
}

.status-indicator.inactive {
  background-color: #cbd5e1;
}

.status-indicator.expired {
  background-color: var(--error);
}

/* Status Grid */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-full {
  grid-column: 1 / -1;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Download Button Small */
.btn-download-sm {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-download-sm:hover {
  background: var(--primary-hover);
}

/* Upload Area */
.upload-area {
  background-color: var(--primary-light);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-area:hover {
  background-color: #dbeafe;
  border-color: var(--primary-hover);
}

.upload-area.dragover {
  background-color: #dbeafe;
  transform: scale(1.01);
}

.upload-area-secondary {
  background-color: #f8fafc;
  border-color: var(--border-hover);
}

.upload-area-secondary:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.upload-icon {
  width: 36px;
  height: 36px;
  color: var(--primary);
}

.upload-text {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-main);
}

.upload-subtext {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--primary);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background-color: var(--border-color);
  border-radius: 9999px;
  transition: background-color 0.2s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

input[type="checkbox"]:checked + .toggle-switch {
  background-color: var(--primary);
}

input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
}

/* Staged Files */
.staged-files-container {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.staged-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.staged-header h4 {
  font-size: 0.875rem;
  font-weight: 600;
}

.file-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-body);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.staged-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.staged-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-icon {
  color: var(--text-secondary);
}

.file-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.actions-row {
  text-align: right;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
}

.btn-secondary {
  background-color: var(--bg-body);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background-color: var(--error-bg);
  color: var(--error);
}

.btn-icon.edit:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Prompts Grid */
.prompts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .prompts-grid {
    grid-template-columns: 1fr;
  }
}

.prompt-dropdown-container {
  margin-bottom: 1rem;
}

.dropdown-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

.prompt-dropdown {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.prompt-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.prompt-preview {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.prompt-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.prompt-preview-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.prompt-actions {
  display: flex;
  gap: 0.25rem;
}

.prompt-preview-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: white;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  margin: 1rem;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #fafbfc;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Results */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.result-item:hover {
  box-shadow: var(--shadow-md);
}

.result-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background-color: var(--bg-card);
}

.result-header:hover {
  background-color: #fafbfc;
}

.result-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
}

.confidence-badge {
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.status-badge {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.badge-pending {
  background-color: #f1f5f9;
  color: #64748b;
}

.badge-processing {
  background-color: #eff6ff;
  color: #3b82f6;
}

.badge-completed {
  background-color: #ecfdf5;
  color: #10b981;
}

.badge-failed {
  background-color: #fef2f2;
  color: #ef4444;
}

.time-badge {
  background-color: #f8fafc;
  color: #475569;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--border-color);
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chevron {
  transition: transform 0.2s;
  color: var(--text-muted);
}

.result-item.open .chevron {
  transform: rotate(180deg);
}

.result-content {
  display: none;
  border-top: 1px solid var(--border-color);
}

.result-item.open .result-content {
  display: block;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.details-table th,
.details-table td {
  padding: 0.625rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.details-table th {
  background-color: #fafbfc;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.details-table tr:last-child td {
  border-bottom: none;
}

/* Batch Bubble */
.batch-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.batch-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.batch-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-pill {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: none;
}

.btn-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.btn-danger {
  background-color: var(--error-bg);
  color: var(--error);
  cursor: pointer;
}

.btn-danger:hover {
  background-color: #fee2e2;
}

/* Pagination */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.5rem 0;
}

.btn-pagination {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-pagination:disabled {
  background: var(--bg-body);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

.page-indicator {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--text-main);
  color: white;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.875rem;
}

.toast.show {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* Pass Details */
.pass-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  background-color: #f8fafc;
}

.pass-block {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pass-block:last-child {
  margin-bottom: 0;
}

.pass-header {
  background-color: #fafbfc;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pass-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.pass-meta-text {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.pass-stages {
  padding: 0;
  border-bottom: 1px solid var(--border-color);
}

.pass-body {
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

/* Top K List */
.top-k-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.top-k-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
}

.top-k-rank {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 2rem;
  text-align: center;
  padding-top: 0.1rem;
}

.top-k-content {
  flex: 1;
}

.top-k-type {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.top-k-reason {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Final Result Block */
.final-result-block {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.final-type-row,
.final-conf-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.final-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 80px;
  flex-shrink: 0;
}

.final-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.confidence-bar-container {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  max-width: 200px;
}

.confidence-bar {
  height: 100%;
  background: var(--success);
  border-radius: 9999px;
}

.final-conf-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.final-reason-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.final-reason-text {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.5;
  background: var(--bg-body);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.no-data {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

/* Step Selection */
.steps-selection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.steps-selection h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.step-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.step-checkbox:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.step-checkbox input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.step-checkbox span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

/* Multi-step Result Blocks */
.step-result-block {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}

.step-result-header {
  background-color: #fafbfc;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.step-result-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.step-result-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.step-result-body {
  padding: 1rem;
}

/* Drawer Routing Result */
.drawer-result {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.drawer-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.drawer-confidence {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.drawer-reasoning {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-main);
  background: var(--bg-body);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

/* Packet Detection */
.packet-single-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.packet-documents-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.packet-document-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.packet-doc-class {
  font-weight: 600;
  color: var(--text-main);
}

.packet-doc-pages {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: monospace;
}

/* Signature Result */
.signature-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.signature-badge.has-signatures {
  background: var(--success-bg);
  color: var(--success);
}

.signature-badge.no-signatures {
  background: var(--bg-body);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Redaction Result */
.redaction-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.redaction-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
}

.redaction-page {
  font-weight: 600;
  color: var(--error);
  white-space: nowrap;
}

.redaction-content {
  font-size: 0.85rem;
  color: var(--text-main);
  flex: 1;
  margin-left: 1rem;
}

.redaction-empty {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
}

/* Prompts Grid 3 columns */
.prompts-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 1024px) {
  .prompts-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .prompts-grid-3 {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }
}

/* Batch Metadata Row */
.batch-metadata-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
  align-items: center;
}

.metadata-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: 0.25rem;
}

/* ============== Developer Tools / Error Simulation Panel ============== */

.dev-tools-panel {
  margin-top: 1.5rem;
  border: 2px solid #f59e0b;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  overflow: hidden;
}

.dev-tools-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.875rem;
  font-weight: 600;
  color: #92400e;
}

.dev-tools-icon {
  font-size: 1rem;
}

.dev-tools-content {
  padding: 1rem;
}

.simulation-modes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sim-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-radio:hover {
  border-color: #f59e0b;
  background: #fffbeb;
}

.sim-radio input[type="radio"] {
  margin-top: 0.25rem;
  accent-color: #f59e0b;
  width: 16px;
  height: 16px;
}

.sim-radio input[type="radio"]:checked + .sim-option {
  color: #92400e;
}

.sim-radio:has(input:checked) {
  border-color: #f59e0b;
  background: #fef3c7;
}

.sim-option {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sim-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.sim-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.sim-status-badge {
  margin-left: auto;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sim-status-badge.sim-off {
  background: #e2e8f0;
  color: #64748b;
}

.sim-status-badge.sim-active {
  background: #fee2e2;
  color: #dc2626;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Simulation Info Panel */
.sim-info {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(245, 158, 11, 0.4);
}

.sim-info:empty {
  display: none;
}

.sim-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
  font-size: 0.8rem;
}

.sim-info-item:last-child {
  margin-bottom: 0;
}

.sim-info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.sim-info-value {
  font-weight: 600;
  color: #92400e;
}

/* Page Range Container (OpenAI only) */
.page-range-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-md);
}

.page-range-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #92400e;
}

.page-range-input {
  width: 60px;
  padding: 0.375rem 0.5rem;
  border: 1px solid #d97706;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-align: center;
  background: white;
}

.page-range-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.page-range-input::placeholder {
  color: #d97706;
  opacity: 0.7;
}

.page-range-separator {
  color: #92400e;
  font-weight: 600;
}
