.sheet-section {
  padding-block: clamp(36px, 6vw, 84px);
  background: var(--clay);
  border-block: 1px solid var(--line);
}

.sheet-shell {
  max-width: 860px;
}

.sheet-heading {
  margin-bottom: clamp(19px, 4vw, 38px);
}

.sheet-heading h2 + p {
  margin-top: 11px;
}

.sheet-return { margin-bottom: 5px; min-height: 48px; }

.sheet-heading p,
.sheet-hint {
  max-width: 62ch;
  color: var(--muted);
}

.sheet-data-note {
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.5;
}

.sheet-editor {
  padding: clamp(16px, 4.1vw, 44px);
  border: 1px solid var(--line);
  background: var(--white);
}

.sheet-mode,
.sheet-step {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sheet-mode > legend {
  margin-bottom: 7px;
  padding: 0;
  font-size: .86rem;
  font-weight: 620;
}

.sheet-mode-options {
  display: grid;
  max-width: 370px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.sheet-mode-options label {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
}

.sheet-mode-options label:has(input:checked) {
  border-color: var(--ochre);
  background: var(--clay);
  color: var(--ink);
  font-weight: 620;
}

.sheet-mode-options input {
  flex: 0 0 auto;
  width: 1.12rem;
  height: 1.12rem;
  margin: 0;
  accent-color: var(--ochre);
}

.sheet-mode-options label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.sheet-progress {
  margin-top: 22px;
  margin-bottom: 8px;
  color: var(--ochre);
  font-size: .82rem;
  font-weight: 650;
}

.sheet-step {
  scroll-margin-top: 15px;
}

.sheet-step:focus {
  outline: none;
}

.sheet-step:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 7px;
}

.sheet-step > legend {
  max-width: 100%;
  margin-bottom: 12px;
  padding: 0;
  font: 400 clamp(1.95rem, 4.1vw, 3rem) / 1.04 var(--serif);
}

.sheet-hint {
  margin-bottom: 11px;
  font-size: .88rem;
}

.sheet-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sheet-field + .sheet-field,
.sheet-pair + .sheet-field {
  margin-top: 14px;
}

.sheet-field label {
  width: fit-content;
  font-size: .92rem;
  font-weight: 620;
}

.sheet-help,
.sheet-criterion {
  color: var(--muted);
  line-height: 1.45;
}

.sheet-criterion {
  padding: 6px 8px;
  background: var(--green-wash);
  overflow-wrap: anywhere;
}

.sheet-mode-hint { margin-top: 8px; }
.sheet-field + .sheet-pair { margin-top: 14px; }

.sheet-field textarea {
  width: 100%;
  min-height: 70px;
  padding: 8px 10px;
  border: 1px solid #a38b71;
  border-radius: 2px;
  background: #fffdf7;
  color: var(--ink);
  font: 400 1rem / 1.45 var(--sans);
  resize: vertical;
}

.sheet-field textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.sheet-pair .sheet-field + .sheet-field {
  margin-top: 0;
}

.sheet-step-actions,
.sheet-tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 11px;
}

.sheet-step-actions {
  margin-top: 18px;
}

.sheet-button,
.sheet-clear-button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--dark);
  background: var(--dark);
  color: var(--white);
  font-size: .87rem;
  font-weight: 620;
  line-height: 1.35;
}

.sheet-button > span {
  margin-left: 4px;
}

.sheet-button-secondary {
  border-color: #a38b71;
  background: transparent;
  color: var(--ink);
}

.sheet-button:hover:enabled {
  border-color: var(--ochre);
  background: var(--ochre);
  color: var(--white);
}

.sheet-button:disabled,
.sheet-clear-button:disabled {
  opacity: .56;
  cursor: default;
}

.sheet-tools {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sheet-preview {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.sheet-preview summary {
  min-height: 44px;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 650;
}

.sheet-preview-content {
  padding: 4px 13px 13px;
  overflow-wrap: anywhere;
}

.sheet-preview-content section + section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sheet-preview-content h3 { margin-bottom: 6px; }
.sheet-preview-content dt { font-size: .86rem; font-weight: 680; }
.sheet-preview-content dd { margin: 2px 0 9px; white-space: pre-wrap; }

.sheet-clear-button {
  border: 0;
  background: transparent;
  color: var(--ochre);
  text-decoration: underline;
  text-underline-offset: .24em;
}

.sheet-clear-confirm {
  max-width: 65ch;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--clay);
}

.sheet-clear-confirm > p {
  margin-bottom: 7px;
}

.sheet-status,
.sheet-save-error {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.sheet-status:empty {
  margin: 0;
}

.sheet-save-error {
  color: #78501d;
  font-weight: 620;
}

.sheet-print {
  display: none;
}

@media (max-width: 520px) {
  .sheet-pair {
    grid-template-columns: 1fr;
  }

  .sheet-step-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .sheet-tools > .sheet-tool-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet-tools > .sheet-tool-actions .sheet-clear-button { justify-self: start; }
  .sheet-button, .sheet-clear-button, .sheet-preview summary { min-height: 48px; }
}

@page fisa-impressere {
  margin: 16mm;
}

@media print {
  body.printing-sheet {
    background: white;
  }

  .printing-sheet > :not(.sheet-print) {
    display: none !important;
  }

  .printing-sheet > .sheet-print {
    display: block;
    max-width: 180mm;
    margin-inline: auto;
    color: #201a15;
    font: 11pt / 1.45 Georgia, serif;
    page: fisa-impressere;
  }

  .sheet-print > p {
    font-size: 9pt;
    letter-spacing: .15em;
  }

  .sheet-print > h2 {
    margin: 2mm 0 5mm;
    padding-bottom: 4mm;
    border-bottom: 1px solid #76604c;
    font: 400 23pt / 1.15 Georgia, serif;
  }

  .sheet-print section + section {
    margin-top: 5mm;
  }

  .sheet-print section > h3 {
    margin-bottom: 2mm;
    font: 600 13pt / 1.2 Georgia, serif;
    break-after: avoid;
  }

  .sheet-print dt {
    margin-top: 2mm;
    font-weight: 600;
    break-after: avoid;
  }

  .sheet-print dd {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  .sheet-print-blank {
    min-height: 6mm;
    border-bottom: 1px solid #b5a99b;
  }
}
