:root {
  --ink: #172026;
  --muted: #65717a;
  --line: #d8dee3;
  --paper: #ffffff;
  --app: #eef2f4;
  --panel: #f9fbfc;
  --capital-green: #008f2f;
  --capital-green-dark: #006326;
  --capital-green-soft: #77aa70;
  --capital-yellow: #f3c30f;
  --capital-blue: #00699c;
  --soft: #edf8ef;
  --danger: #9c2d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--app);
  font-family: Arial, Helvetica, sans-serif;
}

button,
.button,
select,
input,
textarea {
  font: inherit;
}

button,
.button {
  border: 1px solid var(--capital-green);
  background: var(--capital-green);
  color: white;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}

button:hover,
.button:hover {
  filter: brightness(0.96);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost {
  background: transparent;
  color: var(--capital-green);
}

.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.quiet-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: white;
}

.topbar {
  min-height: 78px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
}

.eyebrow {
  color: var(--capital-green);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
  margin-bottom: 4px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 420px) 1fr;
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - 78px);
}

.control-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
  align-self: start;
}

.panel-block {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-block:last-child {
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.file-loader {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px dashed var(--capital-green);
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
  margin: 12px 0;
}

.file-loader span {
  font-weight: 700;
}

.file-loader.dragging,
body.status-drag-active .file-loader {
  background: #dff3e4;
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(0, 143, 47, 0.14);
}

body.status-drag-active::after {
  content: "Soltar STATUS para cargar";
  position: fixed;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 3px dashed var(--capital-green);
  background: rgba(255, 255, 255, 0.72);
  color: var(--capital-green);
  font-weight: 800;
  font-size: 24px;
  z-index: 99;
  pointer-events: none;
}

small,
#statusHint {
  color: var(--muted);
  line-height: 1.35;
}

.field,
.check-row {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.check-row input {
  width: auto;
}

.field span,
.field-grid label span,
.container-row label span,
.document-row label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.field-grid label,
.container-row label,
.document-row label {
  display: grid;
  gap: 5px;
}

.stack {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.container-row,
.document-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.preview-shell {
  min-width: 0;
}

.preview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.report-preview {
  display: grid;
  gap: 18px;
  justify-items: center;
}

.page {
  width: min(100%, 900px);
  height: 1165px;
  background: var(--paper);
  border: 1px solid #cad2d8;
  box-shadow: 0 18px 45px rgba(31, 43, 51, 0.12);
  position: relative;
  overflow: hidden;
}

.report-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 78px;
  background: #fff;
}

.report-band-bottom {
  top: auto;
  bottom: 0;
}

.green-strip {
  height: 28px;
  background: var(--capital-green-soft);
}

.logo-slot {
  height: 50px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 5px 34px 0 0;
}

.logo-slot img {
  max-width: 205px;
  max-height: 43px;
  object-fit: contain;
}

.page-body {
  position: absolute;
  inset: 105px 58px 95px;
  display: flex;
  flex-direction: column;
}

.page-number {
  position: absolute;
  right: 36px;
  bottom: 28px;
  color: var(--muted);
  font-size: 12px;
}

.report-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.brand-mark {
  border-left: 5px solid var(--capital-green-dark);
  padding-left: 14px;
}

.report-title h2 {
  font-size: 27px;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--capital-green-dark);
  font-weight: 800;
}

.report-title p {
  margin-top: 8px;
  color: var(--muted);
}

.cover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 28px;
}

.info-row {
  display: grid;
  grid-template-columns: minmax(120px, 42%) 1fr;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  gap: 12px;
}

.info-row dt {
  color: var(--capital-green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.info-row dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.preview-field {
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 18px;
  background: transparent;
  color: var(--ink);
  resize: none;
  overflow: hidden;
  line-height: 1.25;
}

.preview-field:focus {
  outline: 2px solid rgba(0, 143, 47, 0.25);
  background: #f7fbf8;
}

.intro-page-content {
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-family: Arial, Helvetica, sans-serif;
}

.intro-field {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #000;
  resize: none;
  overflow: hidden;
  line-height: 1.55;
}

.intro-field:focus {
  outline: 2px solid rgba(0, 143, 47, 0.22);
  background: #f7fbf8;
}

.intro-date {
  width: 50%;
  align-self: flex-start;
  text-align: center;
}

.intro-title {
  width: 80%;
  align-self: center;
  text-align: center;
  font-weight: 800;
  text-decoration: underline;
  text-transform: uppercase;
}

.intro-section-title {
  font-weight: 800;
  text-transform: uppercase;
  margin-top: 12px;
}

.intro-paragraph {
  font-size: 16px;
}

.photo-page-content,
.document-page-content {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.reception-title,
.document-page h2,
.conclusion-page h2 {
  text-transform: uppercase;
  font-size: 22px;
  margin-bottom: 18px;
}

.reception-title {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  resize: none;
  overflow: hidden;
  line-height: 1.2;
}

.reception-title:focus {
  outline: 2px solid rgba(0, 143, 47, 0.22);
  background: #f7fbf8;
}

.photo-grid {
  display: grid;
  gap: 16px;
  flex: 1;
  min-height: 0;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.photo-size-full {
  grid-column: 1 / 3;
  grid-row: span 2;
}

.photo-size-half {
  grid-column: 1 / 3;
}

.photo-box {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.photo-box-head {
  background: #eef6ef;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 7px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.photo-title {
  border: 0;
  background: transparent;
  padding: 2px 0;
  font-weight: 700;
  text-transform: uppercase;
  min-width: 0;
  color: var(--capital-green);
}

.remove-photo {
  border-color: var(--capital-green);
  background: white;
  color: var(--capital-green);
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
  white-space: nowrap;
}

.remove-box {
  border-color: var(--danger);
  background: white;
  color: var(--danger);
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
  white-space: nowrap;
}

.photo-size-select {
  width: auto;
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.drop-zone {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fbfcfd;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  touch-action: none;
}

.drop-zone.has-image {
  cursor: grab;
}

.drop-zone.has-image.moving {
  cursor: grabbing;
}

.drop-zone.dragging {
  outline: 3px solid rgba(0, 143, 47, 0.25);
}

.drop-zone span {
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.image-hint {
  position: absolute;
  right: 8px;
  bottom: 7px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 10px;
}

.drop-zone img {
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: contain;
  display: none;
  transform: translate(var(--photo-x, 0), var(--photo-y, 0)) scale(var(--photo-zoom, 1));
  transform-origin: center;
  box-shadow: 0 8px 18px rgba(18, 31, 38, 0.22);
}

.drop-zone.has-image img {
  display: block;
}

.drop-zone.has-image span {
  display: none;
}

.add-photo-line {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.add-photo-size {
  width: auto;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.document-frame {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fafafa;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.document-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 18px rgba(18, 31, 38, 0.18);
}

.conclusion-text {
  margin-top: 18px;
  line-height: 1.65;
  font-size: 16px;
  white-space: pre-wrap;
}

.signature {
  margin-top: 48px;
  font-weight: 700;
  line-height: 1.7;
  text-transform: uppercase;
}

.empty-state {
  color: var(--muted);
  background: white;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
}

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

  .control-panel {
    max-height: none;
  }

  .preview-head,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 10px;
  }

  .page {
    height: auto;
    min-height: 980px;
  }

  .page-body {
    inset: 98px 22px 90px;
  }

  .cover-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .photo-size-full,
  .photo-size-half {
    grid-column: auto;
    grid-row: auto;
  }
}

@page {
  size: Letter;
  margin: 0;
}

body.printing-report * {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html,
  body {
    width: 8.5in;
    min-height: 11in;
    background: white;
    margin: 0 !important;
    padding: 0 !important;
  }

  .topbar,
  .control-panel,
  .preview-head {
    display: none !important;
  }

  .workspace {
    display: block;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0;
  }

  .report-preview {
    display: block;
    margin: 0 !important;
    padding: 0 !important;
  }

  .page {
    width: 8.5in;
    height: 11in;
    border: 0;
    box-shadow: none;
    margin: 0 !important;
    break-after: page;
    page-break-after: always;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  button,
  .button,
  .no-print,
  .add-photo-line {
    display: none !important;
  }

  input.photo-title {
    border: 0;
    padding: 0;
    color: var(--capital-green-dark);
    background: transparent;
  }

  .preview-field {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--ink);
    resize: none;
    overflow: hidden;
  }

  .intro-field {
    border: 0;
    background: transparent;
    resize: none;
    overflow: hidden;
  }

  .reception-title {
    border: 0;
    background: transparent;
    resize: none;
    overflow: hidden;
  }
}
