:root {
  --workflow-ink: #222222;
  --workflow-muted: #6a6a6a;
  --workflow-border: #d9d9d9;
  --workflow-surface: #ffffff;
  --workflow-subtle: #f7f7f7;
  --workflow-accent: #ff385c;
  --workflow-accent-pressed: #e00b41;
  --workflow-error: #c13515;
  --workflow-card-shadow: rgba(0, 0, 0, 0.02) 0 0 0 1px,
    rgba(0, 0, 0, 0.04) 0 2px 6px, rgba(0, 0, 0, 0.1) 0 4px 8px;
  color: var(--workflow-ink);
  font-family: "Airbnb Cereal VF", Circular, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.workflow-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.workflow-page--form {
  width: min(920px, calc(100% - 32px));
}

.card {
  background: var(--workflow-surface);
  border-radius: 20px;
  box-shadow: var(--workflow-card-shadow);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 20px 0 28px;
}

.page-heading h1,
.narrow-layout h1,
.empty-state h1 {
  margin: 4px 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.55px;
  line-height: 1.13;
}

.page-heading p,
.narrow-layout > p,
.empty-state p {
  margin: 0;
  color: var(--workflow-muted);
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--workflow-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted,
.field-help,
.record-card .muted {
  color: var(--workflow-muted);
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(255, 56, 92, 0.38);
  outline-offset: 2px;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button--primary {
  background: var(--workflow-accent);
  color: #fff;
}

.button--primary:hover:not(:disabled) {
  background: var(--workflow-accent-pressed);
}

.button--secondary {
  border-color: var(--workflow-border);
  background: #fff;
  color: var(--workflow-ink);
}

.button--quiet {
  background: transparent;
  color: var(--workflow-ink);
}

.button--danger {
  color: var(--workflow-error);
}

.icon-button {
  width: 44px;
  padding: 0;
  border-color: var(--workflow-border);
  background: #fff;
  color: var(--workflow-ink);
}

.back-link,
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--workflow-ink);
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover,
.text-link:hover {
  text-decoration: underline;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(110px, 0.7fr) auto;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 22px;
  padding: 16px;
  border-radius: 16px;
  background: var(--workflow-subtle);
}

.filter-search {
  flex: 1;
}

.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.form-field[hidden] {
  display: none !important;
}

.form-field label,
.assignment-form label {
  font-size: 14px;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea,
.assignment-form select,
.rename-inline input {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid #bcbcbc;
  border-radius: 8px;
  background: white;
  color: var(--workflow-ink);
  padding: 10px 12px;
  font: inherit;
}

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

.form-field input[type="checkbox"],
.form-field input[type="radio"] {
  width: 20px;
  min-height: 20px;
  accent-color: var(--workflow-accent);
}

.form-field ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.form-field ul label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 400;
}

.field-help {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.field-error,
.errorlist {
  margin: 0;
  color: var(--workflow-error);
  font-size: 13px;
  line-height: 1.4;
}

.errorlist {
  padding-left: 18px;
}

.form-alert {
  margin: 0 0 18px;
  border: 1px solid #e5a697;
  border-radius: 12px;
  background: #fff5f1;
  color: var(--workflow-error);
  padding: 14px 16px;
}

.record-list,
.team-list {
  display: grid;
  gap: 14px;
}

.record-card,
.team-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
}

.record-card h2,
.team-card h2 {
  margin: 4px 0 7px;
  font-size: 20px;
  letter-spacing: -0.3px;
}

.record-card h2 a {
  color: inherit;
  text-decoration: none;
}

.record-card h2 a:hover {
  text-decoration: underline;
}

.record-card p,
.team-card p {
  margin: 0;
  font-size: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  flex: none;
  border-radius: 14px;
  background: #f2f2f2;
  padding: 2px 11px;
  color: var(--workflow-ink);
  font-size: 12px;
  font-weight: 600;
}

.status-badge--submitted {
  background: #fff0e9;
  color: #8a3b12;
}

.status-badge--approved {
  background: #eaf4ed;
  color: #245c36;
}

.pagination,
.pagination > div,
.detail-actions,
.form-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination {
  justify-content: space-between;
  margin-top: 20px;
  color: var(--workflow-muted);
}

.pagination .button {
  min-height: 40px;
}

.empty-state,
.narrow-layout {
  width: min(640px, calc(100% - 32px));
  margin: 60px auto;
  padding: clamp(24px, 6vw, 48px);
}

.empty-state .button,
.narrow-layout .button {
  margin-top: 22px;
}

.empty-inline {
  margin: 16px 0;
  color: var(--workflow-muted);
  font-size: 14px;
}

.stack-form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 0 0 22px;
  border-radius: 14px;
  padding: 16px 20px;
  line-height: 1.45;
}

.notice strong,
.notice span {
  display: block;
}

.notice--attention {
  border: 1px solid #f0c4a9;
  background: #fff8f2;
}

.notice--approved {
  border: 1px solid #c5d8c9;
  background: #f4faf5;
}

.notice .text-link {
  flex: none;
}

.detail-actions {
  flex-wrap: wrap;
  margin: 18px 0 22px;
}

.record-version {
  margin: 18px 0;
  padding: 24px;
}

.record-version--previous {
  border: 1px solid #e5e5e5;
  background: #fbfbfb;
  box-shadow: none;
}

.version-heading,
.version-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.version-heading h2 {
  margin: 0 0 4px;
  font-size: 21px;
}

.version-heading p {
  margin: 0;
  color: var(--workflow-muted);
  font-size: 13px;
}

.answer-section {
  margin-top: 26px;
  border-top: 1px solid #ececec;
  padding-top: 18px;
}

.answer-section h3,
.answer-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 17px;
}

.answer-section dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 22px;
  margin: 0;
}

.answer-section dl > div {
  min-width: 0;
  padding: 10px 0;
}

.answer-section dt {
  color: var(--workflow-muted);
  font-size: 13px;
}

.answer-section dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.section-index {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  background: #f2f2f2;
  font-size: 13px;
  font-weight: 700;
}

.workflow-form {
  display: grid;
  gap: 18px;
}

.form-section {
  border-radius: 20px;
  background: white;
  box-shadow: var(--workflow-card-shadow);
  padding: 24px;
}

.form-section__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.form-section__heading h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.35px;
}

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

.form-field--wide {
  grid-column: 1 / -1;
}

.repeat-field {
  grid-column: 1 / -1;
  min-width: 0;
  border: 1px solid var(--workflow-border);
  border-radius: 14px;
  padding: 16px;
}

.repeat-field > legend {
  padding: 0 6px;
  font-weight: 600;
}

.repeat-items {
  display: grid;
  gap: 12px;
}

.repeat-item[hidden] {
  display: none !important;
}

.repeat-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  padding: 14px;
}

.repeat-item__legend {
  padding: 0 5px;
  color: var(--workflow-muted);
  font-size: 13px;
}

.repeat-item > .button {
  justify-self: start;
}

.form-actions {
  position: sticky;
  z-index: 2;
  bottom: 12px;
  justify-content: flex-end;
  border: 1px solid #e4e4e4;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 12px;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: start;
  gap: 18px;
}

.builder-main {
  display: grid;
  gap: 16px;
}

.builder-section {
  padding: 22px;
}

.builder-section__heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.builder-section__title {
  flex: 1;
}

.builder-section__title h2,
.builder-sidebar h2 {
  margin: 0 0 5px;
  font-size: 19px;
}

.builder-section__title p {
  margin: 0;
  color: var(--workflow-muted);
  font-size: 12px;
}

.builder-section__heading > .button-row {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.rename-inline {
  display: flex;
  gap: 6px;
}

.rename-inline input {
  width: 180px;
  min-height: 40px;
}

.rename-inline .button {
  min-height: 40px;
  padding: 0 10px;
}

.builder-fields {
  margin: 18px 0;
  border-top: 1px solid #eee;
}

.builder-field,
.builder-add-field {
  border-bottom: 1px solid #eee;
  padding: 12px 0;
}

.builder-field > summary,
.builder-add-field > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.builder-field > summary span {
  color: var(--workflow-muted);
  font-size: 13px;
}

.builder-field__form {
  display: grid;
  gap: 14px;
  padding: 16px 4px 4px;
}

.builder-field__form .form-field label {
  font-size: 13px;
}

.builder-add-field {
  margin-top: 14px;
  color: var(--workflow-ink);
  font-weight: 600;
}

.builder-sidebar {
  position: sticky;
  top: 18px;
  padding: 20px;
}

.builder-sidebar .button {
  width: 100%;
}

.publish-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
  padding: 20px 24px;
}

.publish-bar strong,
.publish-bar p {
  display: block;
  margin: 0;
}

.publish-bar p:last-child {
  margin-top: 6px;
  color: var(--workflow-muted);
  font-size: 13px;
}

.team-card {
  align-items: flex-start;
}

.assignment-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assignment-form select {
  min-width: 200px;
}

.print-sheet {
  width: min(850px, calc(100% - 32px));
  margin: 32px auto;
  padding: clamp(24px, 6vw, 48px);
}

.print-sheet > header {
  border-bottom: 2px solid var(--workflow-ink);
  padding-bottom: 18px;
}

.print-sheet > header h1 {
  margin: 4px 0 8px;
  font-size: 34px;
}

.print-sheet > header p:last-child {
  margin: 0;
  color: var(--workflow-muted);
}

.print-actions {
  display: flex;
  gap: 10px;
  margin-top: 32px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 760px) {
  .page-heading,
  .record-card,
  .team-card,
  .notice,
  .publish-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .assignment-form {
    align-items: stretch;
    flex-direction: column;
  }

  .builder-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .builder-sidebar {
    position: static;
    order: -1;
  }

  .builder-section__heading {
    flex-wrap: wrap;
  }

  .builder-section__heading > .button-row {
    width: 100%;
    justify-content: flex-start;
  }

  .field-grid,
  .repeat-item,
  .answer-section dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-actions {
    position: static;
    flex-wrap: wrap;
  }
}

@media print {
  .site-header,
  .site-footer,
  .company-scope-banner,
  .demo-mode-bar,
  .print-actions,
  .workflow-page,
  .button,
  .back-link {
    display: none !important;
  }

  body {
    color: #222;
    background: #fff;
  }

  .page-content {
    width: 100%;
    margin: 0;
  }

  .print-sheet {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #222;
    box-shadow: none;
  }

  .answer-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* The editor has two columns, so let only its page wrapper use the available width. */
.page-content:has(.builder-layout) {
  width: min(96rem, calc(100% - 2rem));
}

.builder-layout,
.builder-main,
.builder-section,
.builder-section__heading,
.builder-section__title {
  min-width: 0;
}

.builder-section__heading,
.builder-section__heading > .button-row,
.rename-inline {
  flex-wrap: wrap;
}

.builder-section__heading > .button-row,
.rename-inline {
  min-width: 0;
  max-width: 100%;
}

.rename-inline input {
  min-width: 0;
  max-width: 100%;
}

.team-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px) minmax(0, 240px); gap: 24px; }
.team-card .assignment-form { display: grid; gap: 10px; }
.team-card .assignment-form select { min-width: 0; width: 100%; }
@media (max-width: 1000px) { .team-card { grid-template-columns: minmax(0, 1fr); } }

.page-content:has(.filter-bar),
.page-content:has(.team-list),
.page-content:has(.access-groups-page) {
  width: min(1120px, calc(100% - 32px));
}

.access-groups-page .builder-section {
  display: grid;
  gap: 24px;
  max-width: 760px;
}

.access-groups-page .form-field > div {
  display: grid;
  gap: 12px;
}

.access-groups-page .form-field > div label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.access-groups-page .form-field input[type="checkbox"] {
  flex: none;
}

@media (min-width: 761px) and (max-width: 1000px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-search {
    grid-column: 1 / -1;
  }
}

.deletion-counts > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid #dce2e8; }
.deletion-counts dd { margin: 0; font-weight: 700; }
.deletion-page .builder-section { margin-top: 1.5rem; }
.deletion-page > .card { padding: 1.25rem; }
.deletion-page button.button--danger { color: #fff; background: #b42318; }
