.aofb-shell {
  margin-top: 12px;
}

.aofb-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid #dcdcde;
  border-radius: 16px;
  background: linear-gradient(135deg, #f7f4ea 0%, #fff 52%, #f2f7f1 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.aofb-topbar h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.aofb-topbar p {
  margin: 0;
  color: #50575e;
}

.aofb-shortcode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #dcdcde;
  background: #fff;
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
}

.aofb-workspace {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

/* Tab bar */
.aofb-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #f0f0f1;
  background: #fcfcfc;
}

.aofb-tab-btn {
  flex: 1;
  padding: 13px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #646970;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.aofb-tab-btn:first-child {
  border-top-left-radius: 16px;
}

.aofb-tab-btn:hover {
  color: #2271b1;
}

.aofb-tab-btn[aria-selected=true] {
  color: #2271b1;
  border-bottom-color: #2271b1;
  background: #fff;
}

.aofb-tab-panel {
  padding: 16px 18px 18px;
}

.aofb-tab-panel[hidden] {
  display: none;
}

.aofb-panel {
  border: 1px solid #dcdcde;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.aofb-panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid #f0f0f1;
  background: #fcfcfc;
}

.aofb-panel-head h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.aofb-panel-head p {
  margin: 0;
  color: #646970;
}

.aofb-panel-body {
  padding: 16px 18px 18px;
}

.aofb-field-bank {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.aofb-field-bank button {
  padding: 12px 10px;
  border: 1px solid #dcdcde;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.aofb-field-bank button:hover {
  border-color: #2271b1;
  box-shadow: 0 4px 14px rgba(34, 113, 177, 0.08);
  transform: translateY(-1px);
}

.aofb-field-bank-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.aofb-field-bank-meta {
  display: block;
  color: #646970;
  font-size: 12px;
}

.aofb-canvas-empty {
  padding: 28px;
  border: 1px dashed #c3c4c7;
  border-radius: 14px;
  background: #fcfcfc;
  text-align: center;
  color: #646970;
}

.aofb-field-card + .aofb-field-card {
  margin-top: 14px;
}

.aofb-field-card {
  border: 1px solid #dcdcde;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.aofb-field-card.is-open {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px rgba(34, 113, 177, 0.08), 0 8px 24px rgba(0, 0, 0, 0.04);
}

.aofb-field-card.is-dragging {
  opacity: 0.55;
}

.aofb-field-card.is-drop-target {
  box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.aofb-field-card.is-locked-antispam .aofb-drag-handle {
  cursor: default;
  opacity: 0.45;
}

.aofb-field-card.is-open > .aofb-field-card-head {
  background: rgba(221, 238, 250, 0.92);
}

.aofb-field-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #eee;
  cursor: pointer;
}

.aofb-field-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.aofb-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--aocfb-accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: grab;
}

.aofb-accordion-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--aocfb-accent);
  line-height: 1;
}
.aofb-accordion-indicator svg {
  width: 16px;
  height: 16px;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.aofb-field-card.is-open .aofb-accordion-indicator svg,
.aofb-submit-card.is-open .aofb-accordion-indicator svg {
  transform: rotate(180deg);
}

.aofb-field-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #c3c4c7;
  border-radius: 3px;
  background: #fff;
  color: #787c82;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.aofb-field-remove:hover, .aofb-field-remove:focus {
  border-color: #d63638;
  background: #fcf0f1;
  color: #b32d2e;
}

.aofb-drag-handle:active {
  cursor: grabbing;
}

.aofb-field-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  background: #eef4fb;
  color: #0a4b78;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.aofb-field-summary strong,
.aofb-field-summary span {
  display: block;
}

.aofb-field-summary strong {
  font-size: 14px;
}

.aofb-field-summary span {
  color: #646970;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.aofb-field-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aofb-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.aofb-field-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid #f0f0f1;
}

.aofb-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  padding-top: 16px;
}

.aofb-field-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aofb-field-control[hidden] {
  display: none;
}

.aofb-field-control.is-full {
  grid-column: 1/-1;
}

.aofb-field-control label {
  font-weight: 600;
}

.aofb-field-control .description {
  margin: 0;
}

.aofb-field-card.is-layout-row {
  background: #f8f9fa;
}

.aofb-field-card.is-layout-row > .aofb-field-card-head {
  background: #eee;
}

.aofb-field-card.is-layout-row.is-open > .aofb-field-card-head,
.aofb-submit-card.is-open > .aofb-submit-card-head {
  background: rgba(221, 238, 250, 0.92);
}

.aofb-field-card.is-incomplete > .aofb-field-card-head {
  background: #fcf0f1;
}

.aofb-field-card.is-incomplete {
  border-color: #d63638;
}

.aofb-row-children {
  display: grid;
  gap: 10px;
  min-height: 70px;
  padding: 12px;
  border: 1px dashed #8c8f94;
  border-radius: 8px;
  background: #fff;
}

.aofb-row-add-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.aofb-row-add-field select {
  min-width: 180px;
}

.aofb-row-children > .aofb-field-card {
  margin-bottom: 0;
}

.aofb-row-empty {
  padding: 12px;
  border-radius: 6px;
  background: #f6f7f7;
  color: #646970;
  text-align: center;
}

.aofb-row-empty[hidden] {
  display: none;
}

.aofb-preview-row {
  display: grid;
  width: 100%;
  margin-bottom: 16px;
}

.aofb-preview-row--cols-auto {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.aofb-preview-row--cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.aofb-preview-row--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aofb-preview-row--cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.aofb-preview-row--gap-sm {
  gap: 8px;
}

.aofb-preview-row--gap-md {
  gap: 16px;
}

.aofb-preview-row--gap-lg {
  gap: 24px;
}

.aofb-file-type-toggle {
  position: relative;
  display: inline-flex;
  width: auto;
  padding: 0 18px 0 0;
  border: 0;
  background: transparent;
  color: #1d2327;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aofb-file-type-toggle::after {
  content: "";
  position: relative;
  top: 7px;
  right: -10px;
  border-top: 5px solid #50575e;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.aofb-file-type-toggle[aria-expanded=true]::after {
  border-top: 0;
  border-bottom: 5px solid #50575e;
  top: -7px;
}

.aofb-file-type-options {
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.aofb-file-type-options[hidden] {
  display: none;
}

.aofb-file-type-group + .aofb-file-type-group {
  margin-top: 10px;
}

.aofb-file-type-group strong {
  display: block;
  margin-bottom: 6px;
}

.aofb-file-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 10px;
}

.aofb-file-type-grid label {
  font-weight: 400;
}

.aofb-settings-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aofb-setting-card {
  padding: 14px;
  border: 1px solid #f0f0f1;
  border-radius: 12px;
  background: #fcfcfc;
}

.aofb-setting-card label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.aofb-setting-card .aofb-datetime-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 8px;
}

.aofb-setting-card .aofb-datetime-input {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.aofb-setting-card .description {
  margin: 8px 0 0;
}

.aofb-setting-card--pro {
  border-style: dashed;
  border-color: #c3c4c7;
  color: #a7aaad;
  padding: 1rem;
}

.aofb-setting-card--pro label {
  color: #a7aaad;
}

.aofb-setting-card--pro input[disabled] {
  background-color: #f0f0f1;
  color: #a7aaad;
  cursor: not-allowed;
}

.aofb-help-list {
  margin: 0;
  padding-left: 18px;
  color: #50575e;
}

.aofb-help-list li + li {
  margin-top: 8px;
}

.aofb-entries-export {
  margin: 16px 0;
}

.aofb-entries-export-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dcdcde;
  background: #fff;
}

.aofb-entries-export-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.aofb-preview-modal[hidden] {
  display: none;
}

.aofb-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.aofb-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.aofb-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, 100vh - 48px);
  overflow: auto;
  border: 1px solid #dcdcde;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.aofb-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f0f1;
  background: #fcfcfc;
}

.aofb-preview-head h3 {
  margin: 0 0 4px;
}

.aofb-preview-head p {
  margin: 0;
  color: #646970;
}

.aofb-preview-body {
  padding: 20px;
}

.aofb-preview-form {
  max-width: 620px;
}

.aofb-preview-field {
  margin-bottom: 16px;
}

.aofb-preview-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.aofb-preview-field input,
.aofb-preview-field select,
.aofb-preview-field textarea {
  width: 100%;
  max-width: 100%;
}

.aofb-preview-choices {
  display: grid;
  gap: 8px;
}

.aofb-preview-choice {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  font-weight: 400 !important;
}

.aofb-preview-choice input {
  width: auto;
}

.aofb-preview-captcha {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  min-width: 220px;
  border: 1px dashed #c3c4c7;
  background: #f6f7f7;
  color: #50575e;
}

.aofb-preview-submit {
  margin-top: 18px;
}

.aofb-submit-card {
  margin-top: 16px;
  border: 1px solid #dcdcde;
  border-radius: 14px;
  background: linear-gradient(180deg, #fcfcfc 0%, #fff 100%);
  overflow: hidden;
}

.aofb-submit-card.is-open {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px rgba(34, 113, 177, 0.08), 0 8px 24px rgba(0, 0, 0, 0.04);
}

.aofb-submit-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: #eee;
}

.aofb-submit-card-body {
  border-top: 1px solid #f0f0f1;
  padding: 0 16px 16px;
}

.aofb-submit-card-body[hidden] {
  display: none;
}

.aofb-submit-card-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.aofb-submit-card-summary strong,
.aofb-submit-card-summary span {
  display: block;
}

.aofb-submit-card-summary strong {
  font-size: 14px;
}

.aofb-submit-card-summary span {
  color: #646970;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.aofb-submit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  background: #eaf7ea;
  color: #226b39;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.aofb-placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.aofb-placeholder-chips .button-link {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #c3d4e8;
  border-radius: 999px;
  background: #eef4fb;
  color: #0a4b78;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.aofb-placeholder-chips .button-link:hover {
  background: #dce9f7;
  border-color: #2271b1;
  color: #135e96;
}

@media (max-width: 960px) {
  .aofb-workspace {
    grid-template-columns: 1fr;
  }
}