* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f2eb;
  color: #243126;
}
body { margin: 0; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  background: #243126;
  color: #fff;
}
h1, h2, h3, p { margin-top: 0; }
main { width: min(1180px, calc(100% - 2rem)); margin: 1rem auto 3rem; }
footer { width: min(1180px, calc(100% - 2rem)); margin: 0 auto 2rem; color: #69756c; }
.card {
  background: #fff;
  border: 1px solid #ded8cc;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(36,49,38,.07);
}
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.editor-grid { align-items: start; }
label { display: grid; gap: .35rem; margin-bottom: .8rem; font-weight: 650; }
input, textarea, button {
  font: inherit;
  border-radius: 10px;
}
input, textarea {
  width: 100%;
  border: 1px solid #cbc3b5;
  padding: .7rem .75rem;
  background: #fffdf9;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
textarea[readonly] { background: #f7f4ed; }
button, .button-like {
  border: 0;
  padding: .72rem .95rem;
  background: #406a45;
  color: white;
  cursor: pointer;
  font-weight: 700;
}
.button-like { text-decoration: none; display: inline-flex; align-items: center; }
button.secondary, .button-like.secondary { background: #e8e2d6; color: #243126; }
button.small, .button-like.small { padding: .45rem .65rem; font-size: .9rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
.button-like:hover { filter: brightness(1.03); }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hidden { display: none !important; }
.muted { color: #69756c; }
.message { min-height: 1.4rem; color: #8a4b21; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-heading.compact { align-items: center; margin-bottom: .35rem; }
.section-heading.compact h3 { margin-bottom: 0; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab-button {
  background: #e8e2d6;
  color: #243126;
  border: 1px solid #d6cdbd;
}
.tab-button.active { background: #406a45; color: #fff; border-color: #406a45; }
.tab-panel { margin-bottom: 1rem; }
.product-list { display: grid; gap: .6rem; margin: .5rem 0 1rem; max-height: 520px; overflow: auto; padding-right: .25rem; }
.product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: .75rem;
  align-items: center;
  border: 1px solid #e3ddcf;
  border-radius: 12px;
  padding: .7rem;
  background: #fbf9f3;
}
.product-row input { text-align: right; }
.product-title { font-weight: 750; }
.product-meta { color: #69756c; font-size: .92rem; margin-top: .15rem; }
.record-list { display: grid; gap: .65rem; margin-top: .75rem; }
.record-card {
  border: 1px solid #e3ddcf;
  background: #fbf9f3;
  border-radius: 12px;
  padding: .8rem;
}
.record-card header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .15rem .5rem;
  background: #e8e2d6;
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
}
.status.accepted { background: #d9ead7; }
.status.rejected { background: #f2d6cf; }
.status.published { background: #dbe7f6; }
pre { white-space: pre-wrap; background: #fff; border-radius: 8px; padding: .6rem; overflow: auto; }
.header-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.docs-link {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  padding: .72rem .95rem;
  background: #e8e2d6;
  color: #243126;
  text-decoration: none;
  font-weight: 700;
}
.docs-link:hover { background: #f4eee2; }
.build-version { margin-top: .25rem; color: #69756c; font-size: .85rem; font-weight: 700; }
@media (max-width: 850px) {
  .grid.two { grid-template-columns: 1fr; }
  .site-header { align-items: flex-start; flex-direction: column; }
  .section-heading { flex-direction: column; }
}
select {
  width: 100%;
  border: 1px solid #cbc3b5;
  border-radius: 10px;
  padding: .7rem .75rem;
  background: #fffdf9;
  font: inherit;
}
.form-package-card {
  border: 1px solid #e3ddcf;
  background: #fbf9f3;
  border-radius: 12px;
  padding: .8rem;
}
.generated-form { display: grid; gap: 1rem; margin-top: 1rem; }
.form-section {
  border: 1px solid #e3ddcf;
  border-radius: 12px;
  padding: .9rem;
  background: #fbf9f3;
}
.form-section legend { font-weight: 800; padding: 0 .35rem; }
.array-section { background: #fffdf9; }
.array-item {
  border: 1px solid #ded8cc;
  border-radius: 10px;
  padding: .75rem;
  margin-bottom: .65rem;
  background: #fff;
}
.array-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.checkbox-row { display: flex; grid-template-columns: none; align-items: center; gap: .5rem; font-weight: 650; }
.checkbox-row input { width: auto; }

.form-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.form-choice-card {
  display: flex;
  min-height: 245px;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #e3ddcf;
  border-radius: 14px;
  padding: 1rem;
  background: #fbf9f3;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.form-choice-card:hover, .form-choice-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(36,49,38,.1);
  border-color: #b8ad9b;
  outline: none;
}
.form-choice-card h3 { margin-bottom: .45rem; }
.form-choice-card p { margin-bottom: .65rem; }
.form-choice-kicker {
  color: #406a45;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.grid.three { grid-template-columns: 1.25fr .85fr .75fr; }
.filter-grid { align-items: end; }
.title-label { max-width: 720px; }
.card-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.form-choice-card { min-height: 280px; }
.form-choice-card .card-actions button { white-space: nowrap; }
.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-bottom: 1rem;
  color: #69756c;
}
.document-viewer { display: block; }
.readonly-form { display: grid; gap: 1rem; }
.readonly-section {
  border: 1px solid #e3ddcf;
  border-radius: 12px;
  padding: .9rem;
  background: #fbf9f3;
}
.readonly-section h3 { margin-bottom: .55rem; }
.readonly-array-item {
  border: 1px solid #ded8cc;
  border-radius: 10px;
  padding: .75rem;
  margin-bottom: .65rem;
  background: #fff;
}
.readonly-field {
  display: grid;
  grid-template-columns: minmax(140px, 32%) minmax(0, 1fr);
  gap: .75rem;
  padding: .45rem 0;
  border-bottom: 1px solid #ede7dd;
}
.readonly-field:last-child { border-bottom: 0; }
.readonly-field span { color: #69756c; }
.readonly-field strong { font-weight: 650; overflow-wrap: anywhere; }
@media (max-width: 850px) {
  .grid.three { grid-template-columns: 1fr; }
  .readonly-field { grid-template-columns: 1fr; gap: .2rem; }
}

.document-shell {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.document-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .75rem;
  padding: .8rem 1rem;
  border: 1px solid #ded8cc;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(36,49,38,.06);
}
.document-header-main { min-width: 0; flex: 1; }
.document-header h2 { margin-bottom: .25rem; }
.document-kicker {
  margin-bottom: .2rem;
  color: #406a45;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.document-actions { justify-content: flex-end; }
.document-viewer,
.document-form-surface {
  width: 100%;
  max-width: none;
  margin: .75rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.document-viewer > *,
.document-form-surface > * {
  width: 100%;
  max-width: none;
}
.editor-description { margin: 0 0 .5rem; }
.modal-title-label {
  max-width: min(720px, 100%);
  margin: .7rem 0 0;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: auto;
  padding: 0;
  background: rgba(36,49,38,.45);
}
.editor-modal {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 1rem;
  border-radius: 0;
  background: #f5f2eb;
  box-shadow: none;
}
body.modal-open { overflow: hidden; }
@media (max-width: 850px) {
  .document-header { flex-direction: column; }
  .document-actions { justify-content: flex-start; }
  .modal-backdrop { padding: 0; }
  .editor-modal { padding: .5rem; }
}
