:root {
  --bg: #f4f6f2;
  --panel: #ffffff;
  --panel-soft: #f8fbf8;
  --line: rgba(18, 69, 56, 0.14);
  --line-strong: rgba(18, 69, 56, 0.22);
  --text: #19352f;
  --muted: #647a73;
  --accent: #176854;
  --accent-strong: #0d5a47;
  --danger: #d64545;
  --shadow: 0 16px 36px rgba(24, 44, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(23, 104, 84, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
}

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

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  margin-bottom: 18px;
}

.hero-brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.hero-mark {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 104, 84, 0.08), rgba(23, 104, 84, 0.02));
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.hero-mark img {
  width: 46px;
  height: 46px;
  display: block;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero h1 {
  margin: 6px 0 8px;
  font-size: 34px;
  line-height: 1.05;
}

.hero-copy {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.hero-meta {
  display: grid;
  gap: 10px;
  min-width: 320px;
}

.meta-chip,
.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.meta-chip strong,
.summary-chip strong {
  color: var(--text);
}

.layout {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 20px 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 21px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn,
.icon-btn {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.btn {
  min-height: 40px;
  padding: 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--panel-soft);
}

.general-grid,
.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #f6fbf8;
  color: var(--text);
}

.field input[type="text"],
.field textarea,
.field select {
  text-transform: uppercase;
}

.field select[data-status-tone="success"] {
  background: #edf9f1;
  border-color: rgba(36, 138, 81, 0.26);
  color: #1f7e4e;
}

.field select[data-status-tone="warning"] {
  background: #fff7e9;
  border-color: rgba(196, 137, 34, 0.28);
  color: #a96a11;
}

.field select[data-status-tone="danger"] {
  background: #fff0f0;
  border-color: rgba(201, 76, 76, 0.3);
  color: #c43f3f;
}

.field select[data-status-tone="info"] {
  background: #eef7ff;
  border-color: rgba(68, 141, 218, 0.28);
  color: #2d73c6;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field-checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding-top: 24px;
}

.field-checkbox > span {
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.field-checkbox input {
  min-height: 16px;
  width: 16px;
  margin: 0;
}

.field-responsaveis,
.field-span-2 {
  grid-column: span 2;
}

.summary-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pages-stack {
  display: grid;
  gap: 14px;
}

.page-editor {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(23, 104, 84, 0.02), rgba(23, 104, 84, 0));
  padding: 18px;
}

.page-editor-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.page-editor-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-editor-title {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
}

.page-editor-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn.danger {
  color: var(--danger);
}

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.photo-preview {
  display: grid;
  gap: 6px;
}

.photo-preview > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.photo-preview-box {
  min-height: 140px;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: #f7faf8;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  display: block;
}

.print-stage {
  display: none;
}

.print-page {
  width: 210mm;
  min-height: 297mm;
  padding: 10mm 9mm 8mm;
  background: #fff;
  color: #0d2e27;
  page-break-after: always;
  display: grid;
  align-content: start;
  gap: 3.2mm;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 11pt;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

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

.print-header {
  display: grid;
  grid-template-columns: 33mm 1fr;
  border: 1px solid #236d5c;
}

.print-title,
.print-section-title,
.print-label,
.print-photo-footer {
  background: #176854;
  color: #fff;
  font-weight: 700;
  font-style: italic;
}

.print-brand {
  min-height: 14.5mm;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2mm 1.5mm;
  background: #fff;
  border-right: 1px solid #236d5c;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-brand img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.print-title {
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 14px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-row,
.print-meta-grid {
  border: 1px solid #236d5c;
}

.print-row.compact {
  display: grid;
  grid-template-columns: 33mm 1fr;
}

.print-label {
  padding: 1.2mm 2.2mm;
  font-size: 11px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-value {
  padding: 1.2mm 2.2mm;
  font-size: 11px;
  border-left: 1px solid #236d5c;
  white-space: pre-wrap;
}

.print-status-value {
  display: flex;
  align-items: center;
  padding-top: 1.4mm;
  padding-bottom: 1.4mm;
}

.print-section-title {
  padding: 1.1mm 2.6mm;
  font-size: 11px;
  text-align: center;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-responsaveis {
  min-height: 18mm;
  border: 1px solid #236d5c;
  border-top: 0;
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.print-responsavel-line {
  min-height: 4.5mm;
  padding: 0.8mm 2.2mm;
  border-bottom: 1px solid #236d5c;
  line-height: 1.3;
}

.print-responsavel-line:last-child {
  border-bottom: 0;
}

.print-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.print-meta-pair {
  display: grid;
  grid-template-columns: 33mm 1fr;
  border-right: 1px solid #236d5c;
  border-bottom: 1px solid #236d5c;
}

.print-meta-pair:nth-child(2n) {
  border-right: 0;
}

.print-meta-pair.field-span-full {
  grid-column: span 2;
  border-right: 0;
}

.print-description {
  min-height: 39mm;
  border: 1px solid #236d5c;
  border-top: 0;
  padding: 1.8mm 2.2mm;
  white-space: pre-wrap;
  line-height: 1.35;
  font-size: 11px;
}

.status-row {
  display: grid;
  grid-template-columns: 33mm 1fr;
}

.print-status-hint {
  margin-top: -1.8mm;
  color: #8c8c8c;
  font-size: 9px;
  text-align: right;
  font-style: italic;
}

.print-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 7mm;
  padding: 0.9mm 3.4mm;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(18, 69, 56, 0.18);
  background: #f3f7f5;
  color: #19352f;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-status-chip[data-tone="success"] {
  background: #dbf3e3;
  border-color: rgba(39, 126, 77, 0.24);
  color: #1f7e4e;
}

.print-status-chip[data-tone="warning"] {
  background: #fff0c9;
  border-color: rgba(196, 137, 34, 0.24);
  color: #a96a11;
}

.print-status-chip[data-tone="danger"] {
  background: #ffe0e0;
  border-color: rgba(201, 76, 76, 0.26);
  color: #c43f3f;
}

.print-status-chip[data-tone="info"] {
  background: #dff0ff;
  border-color: rgba(68, 141, 218, 0.24);
  color: #2d73c6;
}

.print-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4mm;
}

.print-photo-frame {
  display: grid;
  grid-template-rows: 1fr 6mm;
}

.print-photo-box {
  min-height: 66mm;
  border: 1px solid #236d5c;
  border-bottom: 0;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #8c8c8c;
  font-size: 12px;
  padding: 2mm;
}

.print-photo-footer {
  border: 1px solid #236d5c;
  border-top: 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

@media (max-width: 1024px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 12px;
  }

  .hero,
  .panel {
    border-radius: 18px;
    padding: 16px;
  }

  .hero {
    flex-direction: column;
  }

  .hero-brand {
    gap: 12px;
  }

  .hero-mark {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .hero-mark img {
    width: 40px;
    height: 40px;
  }

  .hero-meta,
  .general-grid,
  .editor-grid,
  .photo-preview-grid {
    grid-template-columns: 1fr;
  }

  .field-responsaveis,
  .field-span-2 {
    grid-column: auto;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app-shell {
    width: auto;
    margin: 0;
    padding: 0;
  }

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

  .hero,
  .layout {
    display: none !important;
  }

  .print-stage {
    display: block !important;
  }
}
