.document-editor {
  display: grid;
  gap: 1.25rem;
  margin-block: 1.5rem;
}
.document-editor-intro {
  padding: 1rem 0 0;
  background: transparent;
  color: var(--forest);
  border-top: 1px solid var(--line);
}
.document-editor-intro h3 {
  font-family: var(--font-display, "Plus Jakarta Sans", system-ui);
  font-size: 1.25rem;
  color: inherit;
  margin: 0.3rem 0;
}
.document-editor-intro p {
  color: var(--muted);
  margin-top: 0.5rem;
  max-width: 52ch;
}
.document-checklist {
  border: 1px solid var(--border, #dce5df);
  border-radius: 0.75rem;
  padding: 1rem;
  min-width: 0;
  margin: 0;
}
.document-checklist legend {
  font-family: var(--font-display, "Plus Jakarta Sans", system-ui);
  font-weight: 700;
  padding: 0 0.5rem;
}
.document-check-row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border, #dce5df);
}
.document-check-row:last-child {
  border-bottom: 0;
}
.document-check-row > input {
  margin-top: 0.8rem;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary, #286443);
}
.document-check-row textarea {
  resize: vertical;
  min-height: 6rem;
  width: 100%;
  font: inherit;
  line-height: 1.45;
}
.document-row-tools {
  display: flex;
  gap: 0.25rem;
}
.document-row-tools button {
  min-width: 2.75rem;
  min-height: 2.75rem;
}
.document-checklist > button {
  margin-top: 0.8rem;
}
.document-catalog {
  border: 1px solid var(--border, #dce5df);
  border-radius: 0.75rem;
  padding: 1rem;
}
.document-catalog summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}
.document-catalog > label {
  margin-top: 1rem;
}
.document-catalog-item {
  display: block;
  text-align: left;
  width: 100%;
  padding: 0.7rem;
  margin-block: 0.3rem;
  background: var(--surface, #fafcfa);
  border: 1px solid var(--border, #dce5df);
  border-radius: 0.5rem;
  color: inherit;
  font: inherit;
}
.document-catalog-item span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted, #5d6b64);
}
.document-catalog-item:hover {
  border-color: var(--primary, #286443);
}
.document-image-editor {
  padding: 1.25rem;
  background: var(--background, #edf3ef);
  border-radius: 0.8rem;
}
.document-image-editor img {
  width: 100%;
  max-height: 15rem;
  object-fit: contain;
  object-position: left;
  margin-top: 1rem;
}
.document-image-editor p {
  max-width: 65ch;
}
.document-extras-heading {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.document-extras-heading p {
  max-width: 60ch;
}
.document-extras-heading h1 {
  font-family: var(--font-display, "Plus Jakarta Sans", system-ui);
  margin-block: 0.5rem;
}
.document-receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}
.document-receipt-card {
  background: var(--surface, #fafcfa);
  border: 1px solid var(--border, #dce5df);
  border-radius: 1rem;
  padding: 1.2rem;
}
.document-receipt-card > div:first-child {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}
.document-receipt-card h2 {
  font-family: var(--font-display, "Plus Jakarta Sans", system-ui);
  font-size: 1.15rem;
  margin-block: 0.75rem;
}
.document-receipt-value {
  font-family: var(--font-display, "Plus Jakarta Sans", system-ui);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
}
.document-cancel-reason {
  border-left: 1px solid var(--earth, #6b332a);
  padding-left: 0.6rem;
}
.document-preview {
  background: white;
  color: #15231d;
  padding: 2.4rem;
  margin: auto;
  max-width: 52rem;
  font-family: var(--font-text, "Plus Jakarta Sans", system-ui);
  line-height: 1.55;
}
.document-preview header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #102f25;
  padding-bottom: 1rem;
  color: #102f25;
}
.document-preview h1,
.document-preview h2 {
  font-family: var(--font-display, "Plus Jakarta Sans", system-ui);
  color: #102f25;
}
.document-preview h1 {
  font-size: 1.8rem;
}
.document-preview h2 {
  font-size: 1.1rem;
  margin-top: 1.7rem;
}
.document-preview p,
.document-preview li {
  overflow-wrap: anywhere;
}
.document-minuta {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  color: #6b332a;
}
.document-list-line {
  padding-left: 0.6rem;
}
.document-contract {
  font-size: 1rem;
}
.document-receipt-form [data-receipt-linked] {
  padding: 1rem;
  background: var(--background, #edf3ef);
  border-radius: 0.6rem;
}
.document-receipt-form [data-receipt-words] {
  font-weight: 600;
}
.document-selection {
  margin-top: 0.5rem;
}
.document-check-row .field {
  min-width: 0;
}
.document-check-row [hidden],
.document-catalog-item[hidden],
.document-catalog [hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  .document-editor {
    gap: 1rem;
  }
  .document-checklist {
    padding: 0.7rem;
  }
  .document-check-row {
    grid-template-columns: 1.3rem minmax(0, 1fr);
    gap: 0.5rem;
  }
  .document-row-tools {
    grid-column: 2;
    justify-content: flex-end;
  }
  .document-image-editor {
    padding: 1rem;
  }
  .document-extras-heading {
    display: block;
  }
  .document-extras-heading > .button {
    margin-bottom: 1rem;
  }
  .document-preview {
    padding: 1rem;
  }
  .document-preview header {
    display: block;
  }
  .document-preview header strong {
    display: block;
    margin-top: 0.5rem;
  }
  .document-preview h1 {
    font-size: 1.45rem;
  }
  .document-receipt-card .form-actions {
    flex-wrap: wrap;
  }
}
@media print {
  .document-preview {
    max-width: none;
    padding: 0;
  }
  .document-preview section {
    break-inside: auto;
  }
  .document-preview h2 {
    break-after: avoid;
  }
}

@media (max-width: 650px) {
  .document-composer input:not([type="checkbox"]),
  .document-composer select,
  .document-composer textarea {
    font-size: 16px;
  }
}

.document-representative {
  margin: 1rem 0;
}
.document-representative img {
  display: block;
  width: 100%;
  max-height: 18rem;
  object-fit: contain;
  object-position: left;
}
.document-representative figcaption {
  margin-top: 0.5rem;
  color: var(--muted, #5d6b64);
  font-size: 0.9rem;
}

.document-composer {
  scroll-padding-block: 9rem 7rem;
}
.document-composer
  :is(#quote-identity, #quote-scope, #quote-conditions, #quote-image) {
  scroll-margin-top: 3rem;
}
.document-composer > .quote-section-nav .button {
  background: transparent;
  border: 0;
  border-radius: 0;
  text-decoration: underline;
  text-underline-offset: 0.35rem;
}
.document-composer .form-foot {
  gap: 0.75rem;
}
.document-composer .field-help {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.document-composer .quote-client-link {
  border-left-width: 1px;
}
.document-editor [data-doc-checklists] {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 980px) {
  .document-identity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 2rem;
    align-items: start;
  }
  .document-identity > h3 {
    grid-column: 1 / -1;
  }
  .document-identity .form-grid {
    gap: 1rem;
  }
}
@media (max-width: 650px) {
  .document-composer .form-foot {
    bottom: -1.125rem;
    margin-bottom: -1.125rem;
    padding: 0.75rem 0 1.125rem;
  }
  .document-composer .form-foot > small {
    display: none;
  }
  .document-composer .form-foot .form-actions {
    width: 100%;
  }
}

.document-check-row .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Ajuste nativo à extensão do item, com fallback para navegadores anteriores. */
@supports (field-sizing: content) {
  .document-check-row textarea {
    field-sizing: content;
    min-height: 4.2rem;
  }
}

/* Serviços adicionais do orçamento (layout 5) */
.es-section {
  margin-top: 1rem;
}
.es-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.3rem 0.9rem 0.9rem;
  margin: 0.8rem 0;
  background: var(--white, #fff);
}
.es-card > summary {
  cursor: pointer;
  padding: 0.7rem 0;
  font-size: 1rem;
}
.es-body {
  display: grid;
  gap: 0.9rem;
}
.es-tools {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.es-properties {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}
.es-property {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.8rem;
}
.es-property .button {
  grid-column: 1 / -1;
  justify-self: end;
}
.es-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.3rem 0.8rem;
}
.es-list > summary {
  cursor: pointer;
  padding: 0.6rem 0;
  font-weight: 600;
}
.es-list small {
  color: var(--muted);
  font-weight: 400;
}
.es-detail h4 {
  margin: 1rem 0 0.2rem;
}
@media (max-width: 680px) {
  .es-property {
    grid-template-columns: 1fr;
  }
}
