.pet-exam-editor-wrap {
  --page-w: 595.5px;
  --page-h: 842.25px;
  --ui-blue: #2563eb;
  --ui-blue-soft: #dbeafe;
  --ui-border: #d5def0;
  --ui-bg: #f5f7fb;
  --ui-text: #111827;
  --ui-muted: #6b7280;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --guide: rgba(59, 130, 246, 0.82);
  --guide-fill: rgba(59, 130, 246, 0.03);
  --mark: #1d4ed8;
  --danger: #dc2626;
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  color: var(--ui-text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.pet-exam-editor-wrap *,
.pet-exam-editor-wrap *::before,
.pet-exam-editor-wrap *::after {
  box-sizing: border-box;
}

.pet-exam-editor-wrap input,
.pet-exam-editor-wrap textarea,
.pet-exam-editor-wrap button {
  font: inherit;
}

.pet-exam-editor-wrap input,
.pet-exam-editor-wrap textarea {
  user-select: text;
}

.pet-exam-editor-wrap .pet-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(209, 213, 219, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.pet-exam-editor-wrap .pet-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pet-exam-editor-wrap .pet-toolbar-left strong {
  font-size: 18px;
  line-height: 1.1;
}

.pet-exam-editor-wrap .pet-toolbar-hint {
  font-size: 13px;
  color: var(--ui-muted);
}

.pet-exam-editor-wrap .pet-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pet-exam-editor-wrap .pet-toolbar-right button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.pet-exam-editor-wrap .pet-toolbar-right button:hover {
  transform: translateY(-1px);
  border-color: #94a3b8;
}

.pet-exam-editor-wrap .pet-toolbar-right button.primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border-color: #1d4ed8;
}

.pet-exam-editor-wrap .pet-toolbar-right button.is-active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.pet-exam-editor-wrap .pet-status {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  color: var(--ui-muted);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.pet-exam-editor-wrap .pet-pages {
  display: grid;
  gap: 18px;
}

.pet-exam-editor-wrap .pdf-page-shell {
  width: min(100%, 880px);
  margin: 0 auto;
  position: relative;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.pet-exam-editor-wrap .pdf-page-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--page-w);
  height: var(--page-h);
  transform-origin: top left;
  background: white;
  overflow: hidden;
}

.pet-exam-editor-wrap .pdf-bg,
.pet-exam-editor-wrap .pdf-bg-image {
  position: absolute;
  inset: 0;
  width: var(--page-w);
  height: var(--page-h);
  display: block;
  pointer-events: none;
  user-select: none;
}

.pet-exam-editor-wrap .field-input,
.pet-exam-editor-wrap .field-textarea {
  position: absolute;
  border: 0;
  background: transparent;
  color: #111827;
  padding: 0 2px;
  outline: none;
  z-index: 5;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: clip;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px transparent;
}

.pet-exam-editor-wrap .field-input:focus,
.pet-exam-editor-wrap .field-textarea:focus {
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.58), 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.pet-exam-editor-wrap .field-textarea {
  resize: none;
  padding: 1px 3px;
  line-height: 1.22;
  overflow: hidden;
}

.pet-exam-editor-wrap.show-guides .field-input,
.pet-exam-editor-wrap.show-guides .field-textarea {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.54);
}

.pet-exam-editor-wrap .check-toggle {
  --visual-size: 6.3px;
  --visual-border: 1px;
  --visual-fill-scale: 0.54;
  position: absolute;
  z-index: 6;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: 0.15s ease;
  box-sizing: border-box;
}

.pet-exam-editor-wrap .check-toggle.circle {
  border-radius: 999px;
}

.pet-exam-editor-wrap .check-toggle.square {
  border-radius: 4px;
}

.pet-exam-editor-wrap .check-toggle::before,
.pet-exam-editor-wrap .check-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: 0.15s ease;
  pointer-events: none;
}

.pet-exam-editor-wrap .check-toggle::before {
  width: var(--visual-size);
  height: var(--visual-size);
  border-radius: inherit;
  box-shadow: inset 0 0 0 var(--visual-border) rgba(37, 99, 235, 0.78);
  background: rgba(255, 255, 255, 0.92);
}

.pet-exam-editor-wrap .check-toggle.square::before {
  border-radius: 2px;
}

.pet-exam-editor-wrap .check-toggle::after {
  width: calc(var(--visual-size) * var(--visual-fill-scale));
  height: calc(var(--visual-size) * var(--visual-fill-scale));
  border-radius: inherit;
  background: transparent;
}

.pet-exam-editor-wrap .check-toggle.square::after {
  border-radius: 1px;
}

.pet-exam-editor-wrap .check-toggle.is-checked::after {
  background: var(--mark);
}

.pet-exam-editor-wrap.show-guides .check-toggle::before {
  box-shadow: inset 0 0 0 var(--visual-border) rgba(37, 99, 235, 0.84), 0 0 0 1px rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.96);
}

.pet-exam-editor-wrap .marker-area {
  position: absolute;
  z-index: 4;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: crosshair;
}

.pet-exam-editor-wrap.show-guides .marker-area {
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(254, 242, 242, 0.12);
}

.pet-exam-editor-wrap .marker-dot {
  position: absolute;
  width: calc(7px / var(--editor-scale, 1));
  height: calc(7px / var(--editor-scale, 1));
  margin-left: calc(-3.5px / var(--editor-scale, 1));
  margin-top: calc(-3.5px / var(--editor-scale, 1));
  border-radius: 50%;
  background: var(--danger);
  border: calc(1px / var(--editor-scale, 1)) solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 calc(1px / var(--editor-scale, 1)) rgba(185, 28, 28, 0.16);
  cursor: grab;
  z-index: 7;
}

.pet-exam-editor-wrap .marker-dot:active {
  cursor: grabbing;
}

.pet-exam-editor-wrap .loading {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--ui-muted);
  font-size: 14px;
  background: white;
}

@media (max-width: 720px) {
  .pet-exam-editor-wrap {
    padding: 14px 10px 22px;
  }

  .pet-exam-editor-wrap .pet-toolbar {
    padding: 12px;
    border-radius: 16px;
  }

  .pet-exam-editor-wrap .pet-toolbar-left strong {
    font-size: 16px;
  }

  .pet-exam-editor-wrap .pet-toolbar-right {
    width: 100%;
  }

  .pet-exam-editor-wrap .pet-toolbar-right button {
    flex: 1 1 140px;
    justify-content: center;
  }
}

/* Ajuste visual específico do template de Animais de Produção */
.pet-exam-editor-wrap.is-production-template .check-toggle::before {
  display: none;
}

.pet-exam-editor-wrap.is-production-template .check-toggle::after {
  width: var(--visual-size);
  height: var(--visual-size);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.pet-exam-editor-wrap.is-production-template .check-toggle.is-checked::after {
  background: var(--mark);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92);
}

.pet-exam-editor-wrap.is-production-template.show-guides .check-toggle::before,
.pet-exam-editor-wrap.is-production-template.show-guides .check-toggle::after {
  box-shadow: none;
}

.pet-exam-editor-wrap.is-production-template.show-guides .field-input,
.pet-exam-editor-wrap.is-production-template.show-guides .field-textarea {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.42);
}


/* v1.8.0 – produção usa o círculo impresso do PDF como guia. */
.pet-exam-editor-wrap.is-production-template .check-toggle {
  background: transparent !important;
  border: 0 !important;
  outline: none !important;
}

.pet-exam-editor-wrap.is-production-template .check-toggle::before,
.pet-exam-editor-wrap.is-production-template .check-toggle::after {
  display: none !important;
  opacity: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.pet-exam-editor-wrap.is-production-template .check-toggle .prod-check-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  margin-top: -2px;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.pet-exam-editor-wrap.is-production-template .check-toggle.is-checked .prod-check-dot {
  background: var(--mark);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.94);
}

.pet-exam-editor-wrap.is-production-template.show-guides .check-toggle,
.pet-exam-editor-wrap.is-production-template.show-guides .check-toggle .prod-check-dot {
  background: transparent !important;
  box-shadow: none !important;
}

.pet-exam-editor-wrap.is-production-template.show-guides .field-input,
.pet-exam-editor-wrap.is-production-template.show-guides .field-textarea {
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}
