* { 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; }
}


.form-card-grid:has(.form-company-group) {
  display: block;
}
.form-company-group {
  border: 1px solid #e3ddcf;
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fffdf9;
}
.form-company-group > h3 { margin-bottom: .75rem; }
.form-category-group { margin-top: .9rem; }
.form-category-group > h4 {
  margin: 0 0 .55rem;
  color: #56675a;
}
.form-card-grid.nested {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.source-path {
  font-size: .76rem;
  overflow-wrap: anywhere;
}


.progressive-picker {
  display: grid;
  gap: 1rem;
}
.picker-trail {
  margin: 0;
  padding: .55rem .75rem;
  border: 1px solid #e3ddcf;
  border-radius: 999px;
  background: #fffdf9;
  color: #56675a;
  font-size: .9rem;
  width: fit-content;
}
.picker-step {
  border: 1px solid #e3ddcf;
  border-radius: 18px;
  padding: 1rem;
  background: #fffdf9;
}
.picker-step-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .85rem;
}
.picker-step-heading h3 {
  margin: 0;
}
.picker-step-heading p {
  margin: .15rem 0 0;
  max-width: 42rem;
}
.picker-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.picker-choice {
  border: 1px solid #d7cfbf;
  border-radius: 999px;
  background: #f7f3ea;
  color: #243126;
  padding: .75rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.picker-choice:hover,
.picker-choice.active {
  border-color: #7d8f72;
  background: #e9efe2;
}
@media (max-width: 700px) {
  .picker-step-heading { display: block; }
  .picker-choice { width: 100%; text-align: left; }
}

.build-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  padding: .45rem .7rem;
  color: #f6efe3;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

.picker-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .85rem;
}
.picker-card {
  display: grid;
  gap: .45rem;
  min-height: 132px;
  width: 100%;
  text-align: left;
  border: 1px solid #d7cfbf;
  border-radius: 16px;
  padding: 1rem;
  background: #fbf9f3;
  color: #243126;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.picker-card:hover,
.picker-card.active {
  transform: translateY(-1px);
  border-color: #7d8f72;
  background: #f1f6ea;
  box-shadow: 0 10px 22px rgba(36,49,38,.08);
}
.picker-card-title {
  font-size: 1.05rem;
  font-weight: 850;
}
.picker-card-summary {
  color: #56675a;
  font-weight: 500;
  line-height: 1.42;
}
.picker-card-meta {
  align-self: end;
  width: fit-content;
  border-radius: 999px;
  padding: .18rem .5rem;
  background: #e8e2d6;
  color: #3e4b41;
  font-size: .78rem;
  font-weight: 800;
}
@media (max-width: 700px) {
  .picker-card-grid { grid-template-columns: 1fr; }
  .picker-card { min-height: 0; }
}

.library-browser {
  display: grid;
  gap: 1rem;
}
.picker-control-panel {
  display: grid;
  gap: .7rem;
  min-height: 132px;
  max-height: 170px;
  overflow: hidden;
  padding: .85rem;
  border: 1px solid #ded8cc;
  border-radius: 16px;
  background: #fffdf9;
}
.control-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
  min-height: 48px;
}
.control-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #56675a;
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.control-scroll {
  display: flex;
  gap: .55rem;
  overflow-x: auto;
  padding: .1rem .1rem .35rem;
}
.control-choice {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid #d7cfbf;
  border-radius: 999px;
  padding: .55rem .8rem;
  background: #f7f3ea;
  color: #243126;
  white-space: nowrap;
}
.control-choice small {
  color: #69756c;
  font-size: .75rem;
  font-weight: 750;
}
.control-choice:hover,
.control-choice.active {
  border-color: #7d8f72;
  background: #e9efe2;
}
.help-icon {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid #c8bfaf;
  border-radius: 999px;
  padding: 0;
  background: #f7f3ea;
  color: #406a45;
  font-size: .82rem;
  font-weight: 900;
}
.help-popover {
  position: absolute;
  z-index: 2000;
  width: min(300px, calc(100vw - 24px));
  padding: .85rem;
  border: 1px solid #d7cfbf;
  border-radius: 14px;
  background: #fffdf9;
  box-shadow: 0 14px 36px rgba(36,49,38,.18);
}
.help-popover strong { display: block; margin-bottom: .35rem; }
.help-popover p { margin: 0; color: #56675a; line-height: 1.4; }
.picker-placeholder {
  margin: .35rem 0;
  color: #69756c;
}
.library-empty-state,
.forms-result-area {
  border: 1px solid #e3ddcf;
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
}
.library-empty-state h3 { margin-bottom: .3rem; }
.result-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .85rem;
}
.result-heading h3 { margin-bottom: 0; }
.result-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: .25rem .6rem;
  background: #e8e2d6;
  color: #3e4b41;
  font-size: .78rem;
  font-weight: 850;
}
@media (max-width: 700px) {
  .picker-control-panel { max-height: none; overflow: visible; }
  .control-row { grid-template-columns: 1fr; gap: .35rem; }
}

.session-summary { margin: 0 0 0.75rem 0; }

.permission-summary { margin: .25rem 0 1rem; font-size: .92rem; }
.workspace-panel { margin-bottom: 1rem; }
.workspace-control { max-width: 560px; margin-bottom: .75rem; }
.workspace-control label { margin-bottom: 0; }
.session-summary { margin-bottom: .75rem; }
.permission-summary { margin-top: .5rem; }
