:root {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 1rem;
  background: #f8fafc;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 80rem;
}

.panel {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.subtitle {
  color: #475569;
  margin-top: -0.25rem;
}

.note {
  color: #475569;
  font-size: 0.92rem;
}

label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-right: 0.75rem;
  margin-bottom: 0.75rem;
}

input {
  min-width: 200px;
  max-width: 100%;
  padding: 0.35rem;
}

button {
  cursor: pointer;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}


button[disabled],
input[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.tool {
  min-height: 2.25rem;
}

.state-success {
  color: #15803d;
  font-weight: 600;
}

.state-error {
  color: #b91c1c;
  font-weight: 600;
}

.state-loading {
  color: #0369a1;
  font-weight: 600;
}

.state-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
  background: #e2e8f0;
  border: 1px solid #94a3b8;
}

.state-pill[data-state='error'] {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.operation-item.state-running,
.job-item.state-running {
  border-left: 4px solid #2563eb;
  padding-left: 0.5rem;
}

.operation-item.state-failed,
.job-item.state-failed {
  border-left: 4px solid #b91c1c;
  padding-left: 0.5rem;
}

.operation-item.state-completed,
.job-item.state-completed {
  border-left: 4px solid #15803d;
  padding-left: 0.5rem;
}

.panel > p.note {
  margin-bottom: 0.65rem;
}

#qa-session-state,
#queue-state,
#jobs-state {
  min-height: 1.2rem;
}

.viewer {
  position: relative;
  width: min(100%, 900px);
  aspect-ratio: 8.5 / 11;
  border: 2px dashed #94a3b8;
  background: #f8fafc;
  overflow: hidden;
  margin: 0.75rem 0;
}

.pdf-page-canvas {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform-origin: center center;
  color: #64748b;
  background:
    linear-gradient(45deg, rgba(59, 130, 246, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(59, 130, 246, 0.12) 25%, transparent 25%),
    #f8fafc;
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

#overlays,
#current-rect,
#qa-overlays,
#qa-current-rect {
  position: absolute;
  inset: 0;
}

.overlay-rect,
#current-rect .rect {
  position: absolute;
  border: 2px solid #0891b2;
  box-sizing: border-box;
  pointer-events: none;
}

.overlay-rect.annotation {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.12);
}

.overlay-rect.redaction {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.14);
}

.operation-item,
.job-item,
.artifact-item {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 0;
}

.artifact-links {
  display: flex;
  gap: 1rem;
}

.tool.active {
  background: #0f172a;
  color: #fff;
}

.button-row {
  display: flex;
  gap: 0.5rem;
}

#error-status {
  color: #b91c1c;
  font-weight: 600;
}

#qa-session-state {
  margin: 0;
  padding: 0.75rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  max-height: 18rem;
  overflow: auto;
}

#qa-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

#qa-toolbar label {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  body {
    margin: 0.5rem;
  }

  input {
    min-width: 140px;
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    flex: 1 1 auto;
  }

  .artifact-links {
    flex-direction: column;
    gap: 0.35rem;
  }
}
