/* v632 — Build Form with AI workspace layout-only treatment.
   No AI request, upload, validation, auto-build, XML or postMessage logic is changed. */

:root {
  background: #ffffff;
  color: #25324a;
}

html,
body {
  min-height: 100%;
  background: #ffffff;
}

body {
  color: #25324a;
  scrollbar-width: thin;
  scrollbar-color: #aab2c0 transparent;
}

body::-webkit-scrollbar,
.plan-view::-webkit-scrollbar {
  width: 6px;
}

body::-webkit-scrollbar-track,
.plan-view::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb,
.plan-view::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #aab2c0;
}

.ai-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 14px 22px 0;
  background: #ffffff;
}

.ai-header {
  min-height: 34px;
  margin: 0 0 12px;
  align-items: center;
  justify-content: flex-end;
}

.ai-header > div:first-child {
  display: none;
}

.header-status {
  gap: 8px;
  margin: 0;
}

.status-pill,
.model-pill {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.status-pill {
  border-color: #d8dee8;
  background: #f8fafc;
  color: #64748b;
}

.status-pill.good {
  border-color: #b7dec7;
  background: #eef9f2;
  color: #17633a;
}

.status-pill.bad {
  border-color: #efc1c1;
  background: #fff3f3;
  color: #9f1d1d;
}

.model-pill {
  border-color: #d8d5ff;
  background: #f4f2ff;
  color: #5548d9;
}

.drop-panel,
.card,
.result-banner {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
}

.drop-panel {
  margin: 0 0 16px;
  padding: 12px;
}

.drop-zone {
  min-height: 150px;
  gap: 7px;
  padding: 18px 24px;
  border: 1px dashed #b8b3f8;
  border-radius: 9px;
  background: #fbfcff;
}

.drop-zone:focus-visible,
.drop-zone.is-dragging {
  border-color: #5b50f6;
  box-shadow: 0 0 0 3px rgba(91, 80, 246, 0.15);
}

.drop-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f0eeff;
  color: #5b50f6;
  font-size: 23px;
}

.drop-zone h2 {
  color: #25324a;
  font-size: 15px;
  font-weight: 600;
}

.drop-zone p {
  color: #718096;
  font-size: 11px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 16px;
  align-items: stretch;
}

.card {
  min-height: 330px;
  padding: 18px;
}

.card-header {
  margin-bottom: 14px;
}

.card h2 {
  color: #25324a;
  font-size: 15px;
  font-weight: 600;
}

.eyebrow {
  margin-bottom: 4px;
  color: #718096;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.empty-state {
  min-height: 150px;
  padding: 20px;
  border-color: #eef0f3;
  border-radius: 9px;
  background: #fafbfc;
  color: #718096;
  font-size: 12px;
}

.file-card {
  border-color: #e5e7eb;
  border-radius: 9px;
  background: #fafbfc;
}

.file-name {
  color: #25324a;
}

.file-meta,
.toggle-row small,
.plan-heading p,
.activity-panel p {
  color: #718096;
}

.ai-options {
  margin-top: 14px;
}

.toggle-row {
  gap: 10px;
  padding: 13px;
  border-color: #e5e7eb;
  border-radius: 9px;
}

.toggle-row input {
  accent-color: #5b50f6;
}

.activity-panel {
  border-color: #d8d5ff;
  border-radius: 9px;
  background: #f7f6ff;
}

.spinner {
  border-color: #ddd9ff;
  border-top-color: #5b50f6;
}

.plan-summary > div,
.plan-section {
  border-color: #e5e7eb;
  border-radius: 9px;
  background: #fafbfc;
}

.metric-label,
.control-meta,
.confidence {
  color: #718096;
}

.warnings {
  border-radius: 9px;
}

.primary-button,
.secondary-button {
  min-width: 100px;
  height: 38px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 160ms ease-out,
    border-color 160ms ease-out,
    color 160ms ease-out,
    box-shadow 160ms ease-out,
    transform 160ms ease-out;
}

.primary-button {
  border: 1px solid #5b50f6;
  background: #5b50f6;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(91, 80, 246, 0.22);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #5046e5;
  background: #5046e5;
  box-shadow: 0 5px 12px rgba(91, 80, 246, 0.28);
}

.secondary-button {
  border: 1px solid #a8b4c7;
  background: #ffffff;
  color: #64748b;
  font-weight: 500;
  box-shadow: none;
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #8d9aaf;
  background: #f8fafc;
  color: #475569;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  transition-duration: 80ms;
}

.primary-button:active:not(:disabled) {
  border-color: #463cd4;
  background: #463cd4;
  box-shadow: 0 2px 4px rgba(91, 80, 246, 0.22);
}

.secondary-button:active:not(:disabled) {
  background: #f1f5f9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.primary-button:focus,
.secondary-button:focus {
  outline: none;
}

.primary-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 80, 246, 0.22);
}

.secondary-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 80, 246, 0.18);
}

button:disabled {
  opacity: 0.55;
  transform: none !important;
  box-shadow: none !important;
}

.text-button {
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}

.text-button:hover:not(:disabled) {
  color: #475569;
}

.result-banner {
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 12px;
}

.ai-footer {
  position: sticky;
  z-index: 10;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 64px;
  margin: 16px -22px 0;
  padding: 12px 22px;
  border-top: 1px solid #e8eaf0;
  background: rgba(255, 255, 255, 0.98);
}

.ai-footer .notice {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #718096;
  font-size: 10.5px;
  line-height: 1.45;
}

.ai-footer .notice strong {
  color: #536176;
  font-weight: 600;
}

.ai-footer .actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
}

#debugTraceButton[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .ai-shell {
    padding-inline: 14px;
  }

  .ai-header {
    display: flex;
  }

  .workspace-grid {
    display: block;
  }

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

  .ai-footer {
    grid-template-columns: 1fr;
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .ai-footer .actions {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .primary-button,
  .secondary-button {
    transition: none;
  }

  .primary-button:hover:not(:disabled),
  .secondary-button:hover:not(:disabled),
  .primary-button:active:not(:disabled),
  .secondary-button:active:not(:disabled) {
    transform: none;
  }
}


/* v724 — full-size AI mapping review workspace.
   The upload step remains unchanged; once a plan is ready the same large
   workspace becomes the review surface instead of shrinking the plan. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family:
    Inter,
    "Segoe UI Variable",
    "Segoe UI",
    -apple-system,
    BlinkMacSystemFont,
    ui-sans-serif,
    sans-serif;
  font-size: 12px;
}

.source-preview {
  display: grid;
  min-height: 190px;
  place-items: center;
  margin: -4px -4px 12px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: #f8f9fb;
}

.source-preview img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.source-file-placeholder {
  display: grid;
  width: 58px;
  height: 72px;
  place-items: center;
  margin: 8px auto 12px;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
  background: #fff;
  color: #6b7280;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.source-file-meta {
  min-width: 0;
}

/* Review mode deliberately reuses the existing modal rather than opening a
   second small surface. */
body.ai-review-mode .drop-panel {
  display: none;
}

body.ai-review-mode .ai-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding-top: 12px;
}

body.ai-review-mode .ai-header {
  flex: 0 0 auto;
}

body.ai-review-mode .workspace-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(230px, 0.34fr) minmax(0, 1.66fr);
  gap: 14px;
}

body.ai-review-mode .card {
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

body.ai-review-mode .workspace-grid > .card:first-child {
  display: flex;
  flex-direction: column;
}

body.ai-review-mode .workspace-grid > .card:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

body.ai-review-mode .card-header {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

body.ai-review-mode .card h2 {
  font-size: 13px;
  font-weight: 600;
}

body.ai-review-mode .eyebrow {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.065em;
}

body.ai-review-mode #fileSummary {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

body.ai-review-mode .file-card {
  padding: 10px;
}

body.ai-review-mode .source-preview {
  min-height: 260px;
}

body.ai-review-mode .source-preview img {
  max-height: min(54vh, 560px);
}

body.ai-review-mode .ai-options {
  flex: 0 0 auto;
  margin-top: 10px;
}

body.ai-review-mode .toggle-row {
  padding: 10px;
}

body.ai-review-mode .toggle-row strong {
  font-size: 11.5px;
  font-weight: 550;
}

body.ai-review-mode .toggle-row small {
  font-size: 10px;
}

body.ai-review-mode .plan-view {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

body.ai-review-mode .plan-heading {
  flex: 0 0 auto;
}

body.ai-review-mode .plan-heading h3 {
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 600;
}

body.ai-review-mode .plan-heading p {
  max-width: 820px;
  font-size: 10.5px;
  line-height: 1.4;
}

body.ai-review-mode .plan-summary {
  flex: 0 0 auto;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 7px;
  margin: 9px 0;
}

body.ai-review-mode .plan-summary > div {
  padding: 8px 10px;
  border-radius: 7px;
  background: #fff;
}

body.ai-review-mode .plan-summary strong {
  color: #25324a;
  font-size: 12px;
  font-weight: 600;
}

body.ai-review-mode .metric-label {
  margin-bottom: 2px;
  font-size: 9.5px;
}

.plan-review-toolbar {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  margin: 2px 0 9px;
}

.plan-search {
  flex: 0 1 290px;
}

.plan-search input {
  width: 100%;
  height: 31px;
  padding: 0 11px;
  border: 1px solid #e0e4ea;
  border-radius: 6px;
  outline: none;
  background: #fafbfc;
  color: #25324a;
  font-size: 10.5px;
}

.plan-search input:focus {
  border-color: #a8a0fa;
  box-shadow: 0 0 0 2px rgba(91, 80, 246, 0.10);
}

.plan-search input::placeholder {
  color: #8a94a5;
}

.plan-filters {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-filter {
  min-height: 29px;
  padding: 5px 10px;
  border: 1px solid #e0e4ea;
  border-radius: 999px;
  background: #fff;
  color: #718096;
  cursor: pointer;
  font-size: 10px;
  font-weight: 550;
}

.plan-filter:hover {
  border-color: #c9c5fb;
  color: #5548d9;
}

.plan-filter.is-active {
  border-color: #d3cffd;
  background: #f3f1ff;
  color: #5548d9;
}

.plan-filter span {
  font-variant-numeric: tabular-nums;
}

body.ai-review-mode .warnings {
  flex: 0 0 auto;
  margin-bottom: 8px;
  padding: 9px 11px;
  font-size: 10.5px;
}

.mapping-table {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  border: 1px solid #e7e9ee;
  border-radius: 8px;
  scrollbar-width: thin;
  scrollbar-color: #b4bcc8 transparent;
}

.mapping-section + .mapping-section {
  border-top: 1px solid #e7e9ee;
}

.mapping-section-heading {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid #eceef2;
  background: rgba(248, 249, 251, 0.97);
  color: #69758a;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}

.mapping-section-heading span:last-child {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.mapping-row {
  display: grid;
  grid-template-columns:
    minmax(145px, 1.05fr)
    minmax(145px, 1fr)
    minmax(210px, 1.45fr)
    98px;
  min-height: 48px;
  border-bottom: 1px solid #f0f1f4;
  background: #fff;
}

.mapping-row:last-child {
  border-bottom: 0;
}

.mapping-row:hover {
  background: #fbfbfd;
}

.mapping-cell {
  min-width: 0;
  align-self: center;
  padding: 7px 9px;
  color: #465268;
  font-size: 10.5px;
  line-height: 1.35;
}

.mapping-cell + .mapping-cell {
  border-left: 1px solid #f3f4f6;
}

.mapping-source,
.mapping-understanding,
.mapping-target {
  overflow-wrap: anywhere;
}

.mapping-primary {
  color: #25324a;
  font-weight: 550;
}

.mapping-target {
  color: #5f6c80;
}

.mapping-status {
  text-align: left;
}

.mapping-status-pill {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #dce1e7;
  border-radius: 999px;
  background: #f8fafc;
  color: #536176;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.mapping-status-pill.mapped {
  border-color: #c7e5d2;
  background: #eff8f2;
  color: #247044;
}

.mapping-status-pill.udf {
  border-color: #d8d5ff;
  background: #f4f2ff;
  color: #5548d9;
}

.mapping-status-pill.review {
  border-color: #efd59f;
  background: #fff8e8;
  color: #8a5c13;
}

.mapping-empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 24px;
  color: #718096;
  font-size: 11px;
  text-align: center;
}

body.ai-review-mode .ai-footer {
  flex: 0 0 auto;
  margin-top: 12px;
}

@media (max-width: 980px) {
  body.ai-review-mode .workspace-grid {
    grid-template-columns: minmax(190px, 0.38fr) minmax(0, 1.62fr);
  }

  .mapping-row {
    grid-template-columns:
      minmax(125px, 1fr)
      minmax(125px, 0.9fr)
      minmax(175px, 1.3fr)
      90px;
  }

  .plan-review-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .plan-search {
    flex-basis: auto;
  }
}

@media (max-width: 820px) {
  body.ai-review-mode .workspace-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  body.ai-review-mode .workspace-grid > .card:first-child {
    max-height: 250px;
  }

  body.ai-review-mode .source-preview {
    min-height: 120px;
  }

  .mapping-row {
    grid-template-columns: 1fr;
    padding: 7px 0;
  }

  .mapping-cell {
    padding: 4px 10px;
  }

  .mapping-cell + .mapping-cell {
    border-left: 0;
  }
}


/* v725 — semantic mapping strategy controls and dense review editor. */

.mapping-mode-panel {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 2.28fr);
  gap: 14px 18px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
}

.mapping-mode-copy {
  align-self: center;
  min-width: 0;
}

.mapping-mode-copy h2 {
  margin: 0 0 4px;
  color: #25324a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.mapping-mode-copy p:last-child {
  margin: 0;
  color: #718096;
  font-size: 10.5px;
  line-height: 1.45;
}

.mapping-mode-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
}

.mapping-mode-option {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 58px;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  background: #ffffff;
  color: #536176;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.mapping-mode-option:hover {
  border-color: #c9c5fb;
  background: #fcfbff;
}

.mapping-mode-option.is-selected {
  border-color: #bdb6fa;
  background: #f7f5ff;
  box-shadow: 0 0 0 1px rgba(91, 80, 246, 0.05);
}

.mapping-mode-option input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: #5b50f6;
}

.mapping-mode-option span {
  min-width: 0;
}

.mapping-mode-option strong {
  display: block;
  margin-bottom: 3px;
  color: #334155;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
}

.mapping-mode-option small {
  display: block;
  color: #7a8597;
  font-size: 9.5px;
  line-height: 1.35;
}

.mapping-mode-option.is-selected strong {
  color: #4f46d6;
}

.existing-xml-row {
  grid-column: 1 / -1;
  display: flex;
  min-width: 0;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fafbfc;
}

.existing-xml-row[hidden] {
  display: none !important;
}

.existing-xml-row > div:first-child {
  min-width: 0;
}

.existing-xml-row strong {
  display: block;
  margin-bottom: 2px;
  color: #344054;
  font-size: 10.5px;
  font-weight: 600;
}

.existing-xml-row small {
  display: block;
  color: #718096;
  font-size: 9.5px;
  line-height: 1.4;
}

.existing-xml-actions {
  display: flex;
  min-width: 0;
  flex: 0 1 auto;
  gap: 9px;
  align-items: center;
}

.existing-xml-name {
  display: block;
  max-width: 340px;
  overflow: hidden;
  color: #536176;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-button {
  min-width: 88px;
  height: 31px;
  min-height: 31px;
  padding: 0 12px;
  font-size: 10.5px;
}

.review-accept-button {
  min-width: auto;
  height: 31px;
  min-height: 31px;
  margin-left: auto;
  padding: 0 11px;
  font-size: 10px;
  white-space: nowrap;
}

.mapping-select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 28px 0 9px;
  overflow: hidden;
  border: 1px solid #dfe3e9;
  border-radius: 6px;
  outline: none;
  background-color: #ffffff;
  color: #465268;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-select:hover {
  border-color: #c6c1f8;
}

.mapping-select:focus {
  border-color: #aaa2f6;
  box-shadow: 0 0 0 2px rgba(91, 80, 246, 0.10);
}

.mapping-target-text {
  display: block;
  color: #465268;
  font-size: 10.5px;
  line-height: 1.35;
}

.mapping-understanding small,
.mapping-status small {
  display: block;
  margin-top: 3px;
  color: #8a94a5;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.35;
}

.mapping-status-pill.existing-xml {
  border-color: #c7e5d2;
  background: #eff8f2;
  color: #247044;
}

.mapping-status-pill.employee-property {
  border-color: #d8d5ff;
  background: #f4f2ff;
  color: #5548d9;
}

.mapping-status-pill.udf {
  border-color: #dde2e9;
  background: #f7f8fa;
  color: #536176;
}

.mapping-status-pill.review {
  border-color: #efd59f;
  background: #fff8e8;
  color: #8a5c13;
}

.mapping-row[data-mapping-state="review"] {
  background: #fffdf8;
}

.mapping-row[data-mapping-state="review"]:hover {
  background: #fffaf0;
}

/* Once analysis is ready, the mapping panel becomes a compact strategy strip
   and gives the review grid the majority of the modal height. */
body.ai-review-mode .mapping-mode-panel {
  flex: 0 0 auto;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
}

body.ai-review-mode .mapping-mode-copy {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.ai-review-mode .mapping-mode-copy .eyebrow {
  margin: 0;
}

body.ai-review-mode .mapping-mode-copy h2 {
  margin: 0;
  font-size: 10.5px;
  white-space: nowrap;
}

body.ai-review-mode .mapping-mode-copy p:last-child {
  display: none;
}

body.ai-review-mode .mapping-mode-options {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

body.ai-review-mode .mapping-mode-option {
  min-height: 31px;
  flex: 0 1 auto;
  align-items: center;
  padding: 5px 8px;
  border-radius: 7px;
}

body.ai-review-mode .mapping-mode-option input {
  margin-top: 0;
}

body.ai-review-mode .mapping-mode-option strong {
  margin: 0;
  font-size: 9.5px;
  white-space: nowrap;
}

body.ai-review-mode .mapping-mode-option small {
  display: none;
}

body.ai-review-mode .existing-xml-row {
  grid-column: 1 / -1;
  padding: 7px 9px;
}

body.ai-review-mode .existing-xml-row small {
  display: none;
}

body.ai-review-mode .existing-xml-name {
  max-width: 520px;
}

@media (max-width: 1120px) {
  .mapping-mode-panel {
    grid-template-columns: 1fr;
  }

  .mapping-mode-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.ai-review-mode .mapping-mode-panel {
    grid-template-columns: 1fr;
  }

  body.ai-review-mode .mapping-mode-copy {
    display: none;
  }

  body.ai-review-mode .mapping-mode-options {
    justify-content: flex-start;
    overflow-x: auto;
  }
}

@media (max-width: 700px) {
  .mapping-mode-options {
    grid-template-columns: 1fr;
  }

  .existing-xml-row {
    align-items: stretch;
    flex-direction: column;
  }

  .existing-xml-actions {
    justify-content: space-between;
  }

  body.ai-review-mode .mapping-mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
}


/* v732 — compact setup → explicit Analyse → full-width Mapping Review.
   The source file is never analysed on selection and nothing auto-builds. */

.ai-shell {
  padding: 10px 18px 0;
}

.ai-header {
  min-height: 30px;
  margin-bottom: 10px;
}

.setup-panel,
.review-panel {
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #ffffff;
}

.setup-panel {
  padding: 13px 14px;
}

.setup-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 11px;
}

.setup-heading h2,
.review-header h2 {
  margin: 0;
  color: #25324a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

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

.setup-field {
  min-width: 0;
}

.setup-label {
  display: block;
  margin-bottom: 5px;
  color: #344054;
  font-size: 10.5px;
  font-weight: 600;
}

.setup-help {
  display: block;
  margin-top: 5px;
  color: #7a8597;
  font-size: 9.5px;
  line-height: 1.35;
}

.compact-file-picker {
  display: flex;
  min-width: 0;
  height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 4px 3px 10px;
  border: 1px solid #dfe3e9;
  border-radius: 6px;
  background: #fafbfc;
  cursor: pointer;
  outline: none;
}

.compact-file-picker:hover {
  border-color: #c9c5fb;
  background: #fcfbff;
}

.compact-file-picker:focus-visible,
.compact-file-picker.is-dragging {
  border-color: #aaa2f6;
  box-shadow: 0 0 0 2px rgba(91, 80, 246, 0.10);
}

.compact-file-summary {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  gap: 8px;
  align-items: center;
  overflow: hidden;
}

.compact-file-name {
  min-width: 0;
  overflow: hidden;
  color: #718096;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-file-summary.has-file .compact-file-name {
  color: #25324a;
  font-weight: 550;
}

.compact-file-meta {
  flex: 0 0 auto;
  color: #8a94a5;
  font-size: 9.5px;
  white-space: nowrap;
}

.compact-file-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  align-items: center;
}

.compact-file-actions .text-button {
  height: 28px;
  padding: 0 7px;
  font-size: 9.5px;
}

.compact-file-actions .compact-button {
  height: 28px;
  min-height: 28px;
  min-width: 98px;
  padding: 0 10px;
  font-size: 10px;
}

.strategy-select {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 34px 0 10px;
  border: 1px solid #d8d5ff;
  border-radius: 6px;
  outline: none;
  background: #ffffff;
  color: #25324a;
  font: inherit;
  font-size: 10.5px;
  font-weight: 550;
}

.strategy-select:hover {
  border-color: #bdb6fa;
}

.strategy-select:focus {
  border-color: #aaa2f6;
  box-shadow: 0 0 0 2px rgba(91, 80, 246, 0.10);
}

.setup-panel .existing-xml-row {
  display: flex;
  min-width: 0;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e4e7ec;
  border-radius: 7px;
  background: #fafbfc;
}

.setup-panel .existing-xml-row[hidden] {
  display: none !important;
}

.setup-panel .existing-xml-row strong {
  font-size: 10px;
}

.setup-panel .existing-xml-row small {
  font-size: 9px;
}

.setup-panel .activity-panel {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 7px;
}

.setup-panel .activity-panel strong {
  font-size: 10.5px;
}

.setup-panel .activity-panel p {
  font-size: 9.5px;
}

.setup-panel .spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.review-panel {
  display: flex;
  min-height: 0;
  height: calc(100vh - 116px);
  flex-direction: column;
  padding: 12px 14px 0;
}

.review-panel[hidden] {
  display: none !important;
}

.review-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.review-header p:not(.eyebrow) {
  margin: 2px 0 0;
  color: #718096;
  font-size: 9.5px;
}

.review-panel .plan-view {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.review-panel .plan-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
}

.review-panel .plan-heading h3 {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
}

.review-panel .plan-heading p {
  margin: 0;
  color: #718096;
  font-size: 9.5px;
  line-height: 1.35;
}

.review-panel .plan-summary {
  flex: 0 0 auto;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.review-panel .plan-summary > div {
  padding: 6px 8px;
  border-radius: 6px;
  background: #fafbfc;
}

.review-panel .metric-label {
  margin-bottom: 1px;
  font-size: 9px;
}

.review-panel .plan-summary strong {
  font-size: 11px;
  font-weight: 600;
}

.review-panel .plan-review-toolbar {
  margin: 0 0 7px;
}

.review-panel .mapping-table {
  flex: 1 1 auto;
  min-height: 0;
}

.review-panel .mapping-section-heading {
  min-height: 28px;
  padding: 6px 8px;
}

.review-panel .mapping-row {
  min-height: 43px;
  grid-template-columns:
    minmax(150px, 1.05fr)
    minmax(160px, 1fr)
    minmax(230px, 1.5fr)
    100px;
}

.review-panel .mapping-cell {
  padding: 6px 8px;
  font-size: 10px;
}

.review-panel .mapping-select {
  height: 28px;
  font-size: 9.5px;
}

.review-panel .mapping-status-pill {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 9px;
}

body.ai-review-mode .ai-shell {
  display: flex;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  padding-top: 10px;
}

body.ai-review-mode .ai-header {
  flex: 0 0 auto;
}

body.ai-review-mode .review-panel {
  flex: 1 1 auto;
  height: auto;
}

body.ai-review-mode .ai-footer {
  flex: 0 0 auto;
  margin-top: 8px;
}

.ai-footer {
  min-height: 52px;
  margin: 12px -18px 0;
  padding: 8px 18px;
}

.ai-footer .actions {
  gap: 7px;
}

.ai-footer .primary-button,
.ai-footer .secondary-button {
  min-width: 88px;
  height: 31px;
  min-height: 31px;
  padding: 0 13px;
  border-radius: 6px;
  font-size: 10.5px;
}

#analyseButton {
  min-width: 126px;
}

#buildButton {
  min-width: 100px;
}

#cancelButton {
  min-width: 76px;
}

body:not(.ai-review-mode) #buildButton {
  display: none !important;
}

body.ai-review-mode #analyseButton {
  display: none !important;
}

@media (max-width: 760px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .setup-panel .existing-xml-row {
    align-items: stretch;
    flex-direction: column;
  }

  .review-panel {
    height: calc(100vh - 126px);
  }

  .review-panel .mapping-row {
    grid-template-columns: 1fr;
    padding: 5px 0;
  }

  .review-panel .mapping-cell {
    padding: 3px 8px;
  }

  .review-panel .mapping-cell + .mapping-cell {
    border-left: 0;
  }
}


/* v734 — compact review workspace + one global Accept gate. */

/* The parent Form Studio modal owns the title and AI/model status when embedded. */
body.ai-embedded .ai-header {
  display: none;
}

body.ai-embedded .ai-shell,
body.ai-embedded.ai-review-mode .ai-shell {
  padding-top: 10px;
}

.review-panel {
  padding-top: 10px;
}

.review-header {
  min-height: 52px;
  align-items: center;
  margin-bottom: 6px;
  padding: 7px 10px;
  border: 1px solid #e7e9ee;
  border-radius: 7px;
  background: #fff;
}

.review-title-line {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
}

.review-title-line .eyebrow {
  flex: 0 0 auto;
  margin: 0;
  font-size: 8.5px;
  line-height: 1;
}

.review-title-line h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
}

.review-title-line #reviewContext {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #718096;
  font-size: 9.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-panel .plan-summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 0 7px;
}

.review-panel .plan-summary > div {
  display: flex;
  min-width: 118px;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid #e6e9ee;
  border-radius: 6px;
  background: #fafbfc;
}

.review-panel .metric-label {
  order: 2;
  margin: 0;
  color: #718096;
  font-size: 8.5px;
  line-height: 1;
}

.review-panel .plan-summary strong {
  order: 1;
  color: #25324a;
  font-size: 10.5px;
  line-height: 1;
}

.review-panel .plan-review-toolbar {
  gap: 8px;
  margin: 0 0 7px;
}

.review-panel .plan-search {
  flex: 0 1 270px;
}

.review-panel .plan-search input {
  height: 29px;
}

.review-panel .plan-filter {
  min-height: 27px;
  padding: 4px 9px;
  font-size: 9.5px;
}

.review-panel .mapping-section-heading {
  min-height: 27px;
  padding: 6px 8px;
}

.mapping-section-columns {
  position: sticky;
  z-index: 1;
  top: 27px;
  display: grid;
  grid-template-columns:
    minmax(150px, 0.9fr)
    minmax(220px, 1.15fr)
    minmax(300px, 1.65fr);
  min-height: 26px;
  align-items: center;
  border-bottom: 1px solid #eceef2;
  background: #fff;
  color: #7b8798;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.mapping-section-columns > span {
  min-width: 0;
  padding: 5px 8px;
}

.mapping-section-columns > span + span {
  border-left: 1px solid #f2f3f5;
}

.review-panel .mapping-row {
  grid-template-columns:
    minmax(150px, 0.9fr)
    minmax(220px, 1.15fr)
    minmax(300px, 1.65fr);
  min-height: 44px;
}

.review-panel .mapping-cell {
  padding: 6px 8px;
}

.review-panel .mapping-understanding small {
  margin-top: 2px;
  font-size: 8.5px;
}

.review-panel .mapping-select {
  height: 28px;
}

/* No per-row review/status decoration in v734. */
.mapping-status,
.mapping-status-pill,
.mapping-row[data-mapping-state="review"] {
  display: none !important;
}

body.ai-review-mode .ai-footer {
  margin-top: 7px;
}

#acceptButton {
  min-width: 82px;
}

body:not(.ai-review-mode) #acceptButton {
  display: none !important;
}

body.ai-review-mode #acceptButton[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .review-title-line {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .review-panel .plan-summary {
    overflow-x: auto;
  }

  .mapping-section-columns {
    display: none;
  }

  .review-panel .mapping-row {
    grid-template-columns: 1fr;
  }
}


/* v735 — polished AI review, description source, exclude controls, fresh sessions. */

.source-mode-switch {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 10px;
  padding: 3px;
  border-radius: 8px;
  background: #f5f6f8;
}

.source-mode-button {
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #667085;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.source-mode-button.is-active {
  border-color: #d4cffd;
  background: #ffffff;
  color: #5548d9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.source-mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.source-mode-button.is-active:disabled {
  opacity: 0.82;
}

.description-input {
  display: block;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid #dfe3e9;
  border-radius: 7px;
  outline: none;
  background: #fafbfc;
  color: #25324a;
  font: inherit;
  font-size: 10.5px;
  line-height: 1.45;
}

.description-input:focus {
  border-color: #aaa2f6;
  box-shadow: 0 0 0 2px rgba(91, 80, 246, 0.10);
  background: #fff;
}

.review-panel {
  padding: 10px 12px 0;
  border: 0;
  background: transparent;
}

.review-plan-meta {
  display: none;
}

.review-source-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #e5e8ee;
  border-radius: 8px;
  background: #fff;
}

.review-source-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: #eef1ff;
  color: #5b50f6;
  font-size: 17px;
  font-weight: 700;
}

.review-source-copy {
  min-width: 0;
}

.review-source-copy strong,
.review-source-copy span {
  display: block;
}

.review-source-copy strong {
  overflow: hidden;
  color: #25324a;
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-source-copy span {
  margin-top: 2px;
  color: #7a8597;
  font-size: 9px;
}

.review-source-card .compact-button {
  min-width: 104px;
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 9.5px;
}

body.ai-review-mode .review-panel .plan-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(
      90deg,
      rgba(244, 242, 255, 0.95),
      rgba(250, 251, 255, 0.95)
    );
}

.review-panel .plan-summary > div {
  display: flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 0;
  border-right: 1px solid #e8e6f5;
  border-radius: 0;
  background: transparent;
}

.review-panel .plan-summary > div:last-child {
  border-right: 0;
}

.review-panel .plan-summary strong {
  order: 1;
  color: #25324a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.review-panel .plan-summary .metric-label {
  order: 2;
  margin: 0;
  color: #718096;
  font-size: 8.5px;
  line-height: 1.15;
}

.review-panel .plan-review-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.review-panel .plan-search {
  flex: 0 1 310px;
}

.review-panel .plan-search input {
  height: 30px;
  background: #fff;
}

.review-panel .plan-filters {
  gap: 5px;
}

.review-panel .plan-filter {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 9px;
}

.review-panel .mapping-table {
  border: 1px solid #e5e8ee;
  border-radius: 8px;
  background: #fff;
}

.mapping-section + .mapping-section {
  border-top: 1px solid #e7e9ee;
}

.review-panel .mapping-section-heading {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, #f5f3ff 0%, #fafaff 100%);
  color: #25324a;
  text-align: left;
  cursor: pointer;
}

.mapping-section-title-wrap {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.mapping-section-title-wrap > span:last-child {
  min-width: 0;
}

.mapping-section-title-wrap strong,
.mapping-section-title-wrap small {
  display: block;
}

.mapping-section-title-wrap strong {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-section-title-wrap small {
  margin-top: 2px;
  color: #7b8798;
  font-size: 8.75px;
  font-weight: 500;
}

.mapping-section-chevron {
  width: 14px;
  flex: 0 0 14px;
  color: #5548d9;
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.mapping-section-summary {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  color: #64748b;
  font-size: 8.5px;
  font-weight: 600;
}

.mapping-section-summary span:first-child {
  color: #17824a;
}

.mapping-section-summary span:last-child {
  color: #7a8597;
}

.mapping-section-columns {
  top: 46px;
  grid-template-columns:
    minmax(155px, 0.95fr)
    minmax(230px, 1.25fr)
    minmax(300px, 1.55fr)
    minmax(90px, 0.45fr);
}

.mapping-section-columns > span {
  padding: 5px 8px;
}

.review-panel .mapping-row {
  grid-template-columns:
    minmax(155px, 0.95fr)
    minmax(230px, 1.25fr)
    minmax(300px, 1.55fr)
    minmax(90px, 0.45fr);
  min-height: 48px;
}

.review-panel .mapping-row.is-excluded {
  background: #fafbfc;
  color: #8a94a5;
}

.review-panel .mapping-row.is-excluded .mapping-primary,
.review-panel .mapping-row.is-excluded .mapping-understanding {
  color: #7a8597;
}

.mapping-section.is-collapsed .mapping-section-columns,
.mapping-section.is-collapsed .mapping-section-rows {
  display: none;
}

.mapping-exclude {
  display: flex;
  align-items: center;
}

.exclude-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #536176;
  font-size: 9px;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}

.exclude-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #5b50f6;
}

.mapping-select:disabled {
  background: #f4f5f7;
  color: #8a94a5;
  cursor: not-allowed;
}

body.ai-review-mode .ai-footer .notice {
  font-size: 9.5px;
}



/* v736 — Employee Property XRef editing and clearer unresolved review state. */
.employee-xref-editor {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.employee-xref-editor label {
  color: #667085;
  font-size: 8.75px;
  font-weight: 650;
}

.employee-xref-input {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #dfe3e9;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #25324a;
  font: inherit;
  font-size: 9.5px;
}

.employee-xref-input:focus {
  border-color: #aaa2f6;
  box-shadow: 0 0 0 2px rgba(91, 80, 246, 0.10);
}

.employee-xref-input.is-invalid {
  border-color: #dc6b6b;
  background: #fff8f8;
}

.employee-xref-editor small {
  color: #8a94a5;
  font-size: 8px;
  line-height: 1.3;
}

.mapping-target-unresolved {
  color: #9a5d11;
  font-weight: 600;
}

.mapping-row[data-mapping-state="unresolved"] .mapping-target {
  background: #fffdf7;
}
@media (max-width: 900px) {
  body.ai-review-mode .review-panel .plan-summary {
    grid-template-columns: repeat(3, minmax(90px, 1fr));
  }

  .review-panel .plan-summary > div:nth-child(3) {
    border-right: 0;
  }

  .review-panel .plan-review-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .review-panel .plan-search {
    flex-basis: auto;
  }
}

@media (max-width: 760px) {
  .source-mode-switch {
    width: 100%;
  }

  .source-mode-button {
    flex: 1 1 0;
  }

  .review-source-card {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .review-source-card .compact-button {
    grid-column: 1 / -1;
  }

  body.ai-review-mode .review-panel .plan-summary {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .review-panel .plan-summary > div {
    border-right: 0;
  }

  .mapping-section-summary {
    display: none;
  }

  .mapping-section-columns {
    display: none;
  }

  .review-panel .mapping-row {
    grid-template-columns: 1fr;
  }

  .mapping-exclude {
    padding-top: 2px;
  }
}
