/* Shared Brokermint date picker (must be first — @import is ignored after other rules) */
@import url("/css/bia-date-field.css?v=2");

/*
 * Form Mapper field plates — light enough that printed lines stay readable.
 * 2026-09-12: 0.40 wash hid underlines; keep a faint slate, not a slab.
 */
:root {
  --fm-field-wash: rgba(148, 163, 184, 0.16);
  --fm-field-wash-active: rgba(100, 116, 139, 0.22);
  --fm-field-wash-checked: rgba(100, 116, 139, 0.28);
  --fm-resize-handle-thickness: 5px;
  --fm-resize-grip-size: 5px;
  /* Match fill-engine _ABOVE_LINE_SEAT — grey plate stops above the stroke. */
  --fm-above-line-seat: 1.8pt;
}

.fm-page .fm-shell {
  max-width: 1200px;
}

.fm-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
}

.fm-hero-links a {
  color: var(--accent, #3b82f6);
  text-decoration: none;
}

.fm-hero-links a:hover {
  text-decoration: underline;
}

.fm-toolbar__row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.fm-toolbar__row > .cw-field,
.fm-toolbar__row > .fm-toggle {
  width: 100%;
  margin-bottom: 0;
  flex-shrink: 0;
}

.fm-toolbar__row select.cw-input {
  display: block;
  min-height: 2.35rem;
  -webkit-appearance: menulist;
  appearance: menulist;
}

.fm-toolbar__row > .cw-btn {
  align-self: flex-start;
}

.fm-toolbar__row .fm-search-field {
  flex: 0 0 auto;
  min-width: 0;
}

.fm-search-field {
  min-width: min(100%, 320px);
  flex: 1 1 280px;
}

.fm-search-field input[type="search"] {
  width: 100%;
}

.fm-search-field input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.fm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.fm-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.85rem;
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
}

.fm-stats strong {
  color: var(--text, #14171c);
}

.fm-status {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
}

.fm-status[data-tone="error"] {
  color: #b42318;
}

.fm-status[data-tone="ok"] {
  color: #067647;
}

.fm-table-card {
  margin-top: 1rem;
  overflow-x: auto;
}

.fm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.fm-table th,
.fm-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
  vertical-align: top;
}

.fm-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
}

.fm-table th.num,
.fm-table td.num {
  text-align: right;
  white-space: nowrap;
}

.fm-library__item-meta--usage {
  color: var(--accent, #3b82f6);
  font-weight: 600;
}

.fm-form-name {
  font-weight: 600;
}

.fm-form-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
}

.fm-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.fm-form-name-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding-right: 1.35rem;
}

.fm-form-gold-star {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  font-size: 1.15rem;
  line-height: 1;
  color: #e6a800;
  text-shadow: 0 0 2px rgba(120, 80, 0, 0.45);
}

.fm-form-revision-inline {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.fm-form-revision-inline.is-stale {
  color: #b45309;
}

.fm-badge--gold {
  color: #8a6d0b;
  background: rgba(212, 160, 23, 0.2);
  border: 1px solid rgba(212, 160, 23, 0.45);
  font-weight: 700;
}

.fm-badge--mapped {
  background: #dcfae6;
  color: #067647;
}

.fm-badge--ready {
  background: #d1fadf;
  color: #05603a;
}

.fm-badge--incomplete {
  background: #ffefc7;
  color: #93370d;
}

.fm-badge--needs {
  background: #fef0c7;
  color: #b54708;
}

.fm-badge--na {
  background: #f3f4f6;
  color: #6b7280;
}

.fm-badge--skipped,
.fm-review-form-badge--skipped {
  background: #f3f4f6;
  color: #6b7280;
}

.fm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fm-empty {
  text-align: center;
  color: var(--muted, #6b7280);
  padding: 2rem 1rem !important;
}

.fm-batch-panel {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.fm-batch-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e8edf4;
  overflow: hidden;
  margin-bottom: 0.55rem;
}

.fm-batch-progress-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #3b82f6);
  transition: width 0.25s ease;
}

.fm-batch-progress {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
}

.fm-batch-progress[data-tone="loading"] {
  color: #3b82f6;
}

.fm-batch-complete {
  margin-top: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-batch-complete.is-success {
  background: #ecfdf3;
  border-color: #abefc6;
}

.fm-batch-complete.is-warning {
  background: #fffaeb;
  border-color: #fedf89;
}

.fm-batch-complete h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.fm-batch-complete p {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
}

.fm-batch-complete__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}

.fm-batch-complete__stats strong {
  color: var(--text, #14171c);
}

.fm-batch-complete__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.fm-batch-complete__list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}

.fm-batch-complete__list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.86rem;
}

.fm-batch-complete__list li:last-child {
  border-bottom: none;
}

.fm-batch-complete__errors {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: #b42318;
}

.fm-batch-progress[data-tone="error"] {
  color: #b42318;
}

.fm-batch-progress[data-tone="ok"] {
  color: #067647;
}

#fm-map-all:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fm-review-page .cw-shell.fm-review-shell {
  padding-top: 0.35rem;
  padding-bottom: 0.65rem;
}

.fm-review-shell {
  max-width: none;
  width: min(100%, 1680px);
}

.fm-review-topbar {
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.7rem 0.5rem;
}

.fm-review-topbar__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.4rem;
}

.fm-review-topbar h1 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.2;
}

.fm-review-topbar__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin: 0;
  font-size: 0.8rem;
}

.fm-review-topbar__links a {
  color: var(--accent, #3b82f6);
  text-decoration: none;
}

.fm-review-topbar__links a:hover {
  text-decoration: underline;
}

.fm-review-filters-row {
  gap: 0.45rem 0.7rem;
}

.fm-review-page .fm-review-topbar .cw-label {
  font-size: 0.7rem;
  margin-bottom: 0.12rem;
}

.fm-review-page .fm-review-topbar .cw-input {
  padding: 0.32rem 0.48rem;
  font-size: 0.84rem;
}

.fm-review-page .fm-review-topbar .fm-toggle {
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

.fm-review-map-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 0.55rem;
  padding: 0.32rem 0.55rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  background: #f9fafb;
}

.fm-review-map-strip__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
}

.fm-review-map-field .cw-label {
  font-size: 0.65rem;
  margin-bottom: 0.08rem;
}

.fm-review-map-field .cw-input--narrow {
  width: 2.6rem;
  padding: 0.22rem 0.3rem;
  font-size: 0.78rem;
}

.fm-review-map-toggle {
  margin-bottom: 0;
  font-size: 0.74rem;
  gap: 0.3rem;
}

.fm-review-map-save {
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.fm-review-map-save.is-dirty {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

/* Firebase last-saved stamp on the open form (compact: "FB 8/3 2:32p") */
.fm-firestore-saved {
  margin: 0.1rem 0 0;
  padding: 0.1rem 0.35rem;
  display: inline-block;
  max-width: min(100%, 11rem);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-firestore-saved.is-missing {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}
.fm-firestore-saved[hidden] {
  display: none !important;
}

/* Full Firebase proof banner under form title — always readable after Force save */
.fm-firebase-proof {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.35rem 0 0;
  padding: 0.4rem 0.55rem;
  max-width: min(100%, 36rem);
  border-radius: 8px;
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  font-size: 0.78rem;
  line-height: 1.3;
}
.fm-firebase-proof[hidden] {
  display: none !important;
}
.fm-firebase-proof__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #94a3b8;
  flex: 0 0 auto;
}
.fm-firebase-proof__text {
  flex: 1 1 auto;
  min-width: 10rem;
  font-weight: 700;
  color: #0f172a;
}
.fm-firebase-proof__btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.22rem 0.55rem;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #fff;
  color: #0f766e;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.fm-firebase-proof__btn:hover {
  background: #ecfdf5;
}
.fm-firebase-proof__btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.fm-firebase-proof.is-verified {
  border-color: #86efac;
  background: #f0fdf4;
}
.fm-firebase-proof.is-verified .fm-firebase-proof__dot {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}
.fm-firebase-proof.is-verified .fm-firebase-proof__text {
  color: #14532d;
}
.fm-firebase-proof.is-missing {
  border-color: #fcd34d;
  background: #fffbeb;
}
.fm-firebase-proof.is-missing .fm-firebase-proof__dot {
  background: #d97706;
}
.fm-firebase-proof.is-missing .fm-firebase-proof__text {
  color: #92400e;
}
.fm-firebase-proof.is-dirty {
  border-color: #93c5fd;
  background: #eff6ff;
}
.fm-firebase-proof.is-dirty .fm-firebase-proof__dot {
  background: #2563eb;
}
.fm-firebase-proof.is-error {
  border-color: #fca5a5;
  background: #fef2f2;
}
.fm-firebase-proof.is-error .fm-firebase-proof__dot {
  background: #dc2626;
}
.fm-firebase-proof.is-error .fm-firebase-proof__text {
  color: #991b1b;
}
.fm-firebase-proof.is-checking {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.fm-firebase-proof.is-checking .fm-firebase-proof__dot {
  background: #64748b;
  animation: fm-firebase-pulse 1s ease-in-out infinite;
}
@keyframes fm-firebase-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* While saving: look busy but stay clickable (do not rely on :disabled). */
.fm-review-map-save.is-saving {
  opacity: 0.92;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.55);
}

/* Always-available force save — bottom right, above stuck toolbars */
.fm-force-save-chip {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10050;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  max-width: min(22rem, calc(100vw - 2rem));
  line-height: 1.25;
  text-align: center;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.fm-force-save-chip:hover:not(:disabled) {
  background: #1e40af;
}
.fm-force-save-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.fm-force-save-chip.is-saving {
  background: #b45309;
  box-shadow: 0 8px 24px rgba(180, 83, 9, 0.35);
  animation: fm-firebase-pulse 1.4s ease-in-out infinite;
}
.fm-force-save-chip.is-saving:hover:not(:disabled) {
  background: #92400e;
}
/* Stuck >12s: urgent amber — click unlocks and re-saves the map */
.fm-force-save-chip.is-stuck {
  background: #c2410c;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.55), 0 8px 24px rgba(194, 65, 12, 0.4);
  animation: fm-force-stuck-pulse 0.9s ease-in-out infinite;
}
.fm-force-save-chip.is-stuck:hover:not(:disabled) {
  background: #9a3412;
}
@keyframes fm-force-stuck-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.fm-force-save-chip.is-verified {
  background: #15803d;
  box-shadow: 0 8px 24px rgba(21, 128, 61, 0.28);
  animation: none;
}
.fm-force-save-chip.is-verified:hover:not(:disabled) {
  background: #166534;
}
.fm-force-save-chip[hidden] {
  display: none !important;
}

/* Main Save mapping button — match stuck language */
.fm-review-map-save.is-stuck,
#fm-review-save.is-stuck,
#fm-review-save-bar.is-stuck {
  background: #c2410c !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.65);
  animation: fm-force-stuck-pulse 0.9s ease-in-out infinite;
}

/* Zoom slider in Form Mapper top toolbar — compact */
body.fm-mapper-cw-match .fm-mapper-chrome__toolbar .cw-map-preview-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  margin-left: 0.1rem;
  padding: 0.05rem 0.22rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  flex: 0 0 auto;
}

body.fm-mapper-cw-match .fm-mapper-chrome__toolbar .cw-map-preview-zoom__btn {
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0 0.2rem;
  font-size: 0.85rem;
  line-height: 1;
}

body.fm-mapper-cw-match .fm-mapper-chrome__toolbar .cw-map-preview-zoom__range {
  width: 4.75rem;
  height: 1rem;
  accent-color: #4b5563;
  cursor: pointer;
}

body.fm-mapper-cw-match .fm-mapper-chrome__toolbar .cw-map-preview-zoom__label {
  min-width: 2.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #374151;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

body.fm-mapper-cw-match .fm-mapper-chrome__toolbar .fm-review-map-save,
body.fm-mapper-cw-match .cw-map-preview-mapping-bar__actions .fm-review-map-save {
  background: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

body.fm-mapper-cw-match .fm-mapper-chrome__toolbar .fm-review-map-save:disabled,
body.fm-mapper-cw-match .cw-map-preview-mapping-bar__actions .fm-review-map-save:disabled {
  opacity: 0.45;
}

.fm-review-map-delete:not(:disabled) {
  color: #b42318;
}

.fm-review-map-delete:not(:disabled):hover {
  background: #fef2f2;
}

.fm-review-delete-form:not(:disabled) {
  color: #b42318;
}

.fm-review-delete-form:not(:disabled):hover {
  background: #fef2f2;
}

.fm-review-signer-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem 0.35rem;
  flex: 0 0 auto;
}

.fm-review-signer-bar__title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}

.fm-review-signer-bar__choices {
  display: inline-flex;
  gap: 0.18rem;
}

.fm-review-signer-btn {
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
}

.fm-review-signer-btn:hover {
  border-color: #7e57c2;
  color: #5e35b1;
}

.fm-review-signer-btn.is-active {
  border-color: #5e35b1;
  background: #ede7f6;
  color: #4527a0;
  box-shadow: inset 0 0 0 1px rgba(94, 53, 177, 0.18);
}

.fm-review-signer-chip {
  display: inline-block;
  margin-right: 0.2rem;
  padding: 0.02rem 0.32rem;
  border-radius: 999px;
  background: #ede7f6;
  color: #4527a0;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.fm-review-signer-hint {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
  line-height: 1.3;
}

.fm-review-party-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
  line-height: 1.35;
}

.fm-review-esign-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
}

.fm-review-esign-bar--compact {
  flex: 1 1 auto;
  justify-content: center;
  min-width: min(100%, 22rem);
}

.fm-review-esign-bar__title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
  flex: 0 0 auto;
}

.fm-review-esign-bar__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  flex: 0 1 auto;
  justify-content: center;
}

.fm-review-esign-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.22rem 0.42rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.fm-review-esign-tool:hover {
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.fm-review-esign-tool.is-selected {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.15);
}

.fm-review-esign-tool--compact {
  padding: 0.18rem 0.38rem;
  font-size: 0.66rem;
}

.fm-review-esign-tool.is-text {
  color: #3b82f6;
}

.fm-review-esign-tool.is-text {
  border-color: #93c5fd;
  background: #eff6ff;
}

.fm-review-esign-tool.is-money {
  border-color: #a5d6a7;
  background: #e8f5e9;
}

.fm-review-esign-tool.is-strikethrough {
  border-color: #ef9a9a;
  background: #ffebee;
}

.fm-review-esign-tool.is-checkbox {
  border-color: #ffcc80;
  background: #fff3e0;
}

.fm-review-esign-tool.is-signature {
  border-color: #ce93d8;
  background: #f3e5f5;
}

.fm-review-esign-tool.is-initials {
  border-color: #b39ddb;
  background: #ede7f6;
}

.fm-review-esign-tool.is-datetime {
  border-color: #a5d6a7;
  background: #e8f5e9;
}

.fm-review-scope {
  margin: 0.28rem 0 0;
  font-size: 0.74rem;
  color: var(--muted, #6b7280);
  line-height: 1.3;
}

.fm-review-search-field {
  position: relative;
}

.fm-review-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.fm-review-search-hit {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.fm-review-search-hit:hover,
.fm-review-search-hit.is-active {
  background: #eff6ff;
}

.fm-review-search-hit__name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text, #14171c);
}

.fm-review-search-hit__meta {
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}

.fm-review-search-empty,
.fm-review-search-more {
  margin: 0.25rem 0.35rem;
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
}

.fm-review-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.fm-review-nav__label {
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
  min-width: 4.5rem;
  text-align: center;
}

.fm-review-page #fm-review-app {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 6.5rem);
}

.fm-review-workspace {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 0.55rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 10.5rem);
  max-height: calc(100vh - 10.5rem);
}

.fm-review-fields-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  max-height: calc(100vh - 10rem);
  padding: 0.65rem 0.75rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.fm-review-fields-panel .cw-calibrate-field-list {
  max-height: none;
  overflow: visible;
}

.fm-review-sidebar-section {
  padding-bottom: 0.7rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-review-sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.fm-review-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
}

.fm-review-needs-section {
  flex: 0 0 auto;
}

.fm-review-needs-list {
  display: grid;
  gap: 0.45rem;
}

.fm-review-needs-list > li {
  min-height: 3.75rem;
}

.fm-review-needs-list .cw-calibrate-field-btn {
  height: 100%;
  min-height: 3.75rem;
  padding: 0.55rem 0.65rem;
  align-content: center;
}

.fm-review-needs-list .cw-calibrate-field-btn__label {
  font-size: 0.86rem;
  line-height: 1.25;
  white-space: normal;
}

.fm-review-fields-section {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.fm-review-fields-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
}

.fm-review-fields-section__title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #374151;
}

.fm-review-fields-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 700;
}

.fm-review-fields-section .fm-review-field-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fm-review-needs-more {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}

.fm-review-all-forms-section {
  flex: 0 0 auto;
}

.fm-review-all-forms-list {
  display: grid;
  gap: 0.35rem;
}

.fm-review-form-btn--compact {
  padding: 0.4rem 0.5rem;
}

.fm-review-form-btn--compact .cw-calibrate-field-btn__label {
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: normal;
}

.fm-review-fields-section .fm-review-field-list {
  margin-bottom: 0.45rem;
}

.fm-review-add-dropdown-section {
  flex: 0 0 auto;
}

.fm-review-add-field-btn {
  width: 100%;
  margin-top: 0.35rem;
}

.fm-review-main {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.fm-review-form-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.35rem 0.55rem;
  align-items: center;
  padding: 0.32rem 0.55rem;
  flex-shrink: 0;
}

.fm-review-form-header__title {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.2;
}

.fm-review-form-header__meta {
  margin: 0.1rem 0 0;
  font-size: 0.74rem;
  color: var(--muted, #6b7280);
}

.fm-review-form-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.fm-review-canvas-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.fm-review-status {
  margin: 0;
  padding: 0.15rem 0.55rem 0;
  font-size: 0.72rem;
  line-height: 1.25;
  flex-shrink: 0;
}

.fm-review-canvas-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  /* Middle contract: vertical scroll only (no horizontal). */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  /* Stop browser scroll-anchoring from flinging the PDF when field boxes move/update */
  overflow-anchor: none;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.65rem 0.75rem 0.75rem;
  background: #f3f4f6;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
  touch-action: pan-y;
}

.fm-review-canvas-scroll * {
  overflow-anchor: none;
}

.fm-review-canvas-scroll::-webkit-scrollbar {
  width: 10px;
  height: 0;
}

.fm-review-canvas-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.fm-review-canvas-scroll::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.fm-review-canvas-scroll::-webkit-scrollbar-thumb:hover {
  background: #64748b;
  background-clip: padding-box;
}

.fm-review-document {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 0 0.5rem 1rem;
  box-sizing: border-box;
}

.fm-review-page-shell {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.fm-review-page-shell.is-current-page .fm-review-page-label {
  color: var(--accent, #3b82f6);
  font-weight: 700;
}

.fm-review-page-shell.is-page-loading .fm-review-page-stage canvas {
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
}

.fm-review-page-label {
  margin: 0 0 0.4rem;
  width: 100%;
  max-width: 100%;
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  text-align: left;
}

.fm-review-page-label.is-body-only {
  color: #92400e;
  font-weight: 600;
}

.fm-review-page-shell.is-body-only-page .fm-review-page-stage {
  opacity: 0.92;
}

.fm-review-page-shell.is-body-only-page .fm-review-page-overlay {
  pointer-events: none;
}

[data-dock-fill] {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
}

[data-dock-fill="main"] {
  display: flex;
  flex-direction: column;
}

[data-dock-fill="contract"] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

[data-dock-fill="workspace"] {
  flex: 1 1 auto;
  min-width: 0;
}

[data-dock-fill="pdf"],
.fm-mapper__canvas-stage,
.cw-calibrate-canvas-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.fm-review-page-stage {
  position: relative;
  display: flex;
  justify-content: center;
  width: fit-content;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
  cursor: crosshair;
}

.fm-review-page-stage canvas {
  display: block;
  background: #fff;
}

.fm-review-page-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fm-review-page-overlay .fm-review-field {
  pointer-events: auto;
  overflow: visible; /* allow multi-side resize handles outside the box */
}

.fm-placement-guides {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

/* Snap-to-PDF lines only (shown when aligned). No free-drag crosshairs. */
.fm-placement-guide {
  position: absolute;
  display: none;
  background: rgba(22, 163, 74, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.fm-placement-guide--v {
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
}

.fm-placement-guide--h {
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-1px);
}

.fm-placement-guides.is-snapped-x .fm-placement-guide--v {
  display: block;
}

.fm-placement-guides.is-snapped-y .fm-placement-guide--h {
  display: block;
}

.fm-review-field {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  padding: 0;
  overflow: visible;
  user-select: none;
}

.fm-review-field.is-drag-pending,
.fm-review-field.is-dragging {
  cursor: grabbing;
  z-index: 20;
  opacity: 0.96;
  /* Promote layer so left/top updates stay smooth while dragging */
  will-change: left, top;
  transform: translateZ(0);
}

.fm-review-field.is-drag-pending .fm-review-field__body {
  outline: none;
  border-style: dashed;
  border-color: rgba(51, 65, 85, 0.95);
}

.fm-review-field.is-dragging .fm-review-field__body {
  box-shadow: none;
}

.fm-review-field.is-resizing,
.fm-review-field.is-font-resizing {
  z-index: 7;
  opacity: 0.95;
}

.fm-review-field.is-resizing .fm-review-field__body {
  box-shadow: none;
  align-items: center;
  justify-content: center;
  padding-top: 0;
}

/*
 * Text pos (L / C / R): horizontal only. Body keeps text vertically mid-box;
 * full-width sample/input so text-align actually moves glyphs left/center/right.
 * (Previous flex rules left justify-content:flex-start and broke center/right.)
 */
.fm-review-field--align-left .fm-review-field__body,
.fm-review-field--align-center .fm-review-field__body,
.fm-review-field--align-right .fm-review-field__body,
.fm-review-field--map.fm-review-field--align-left .fm-review-field__body,
.fm-review-field--map.fm-review-field--align-center .fm-review-field__body,
.fm-review-field--map.fm-review-field--align-right .fm-review-field__body,
.fm-review-field--centered .fm-review-field__body,
.fm-review-field--map.fm-review-field--centered .fm-review-field__body {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 0 2px !important;
}

.fm-review-field--align-left .fm-review-field__sample,
.fm-review-field--align-left .fm-review-field__placeholder,
.fm-review-field--align-left .fm-review-field__fill-input,
.fm-review-field--align-center .fm-review-field__sample,
.fm-review-field--align-center .fm-review-field__placeholder,
.fm-review-field--align-center .fm-review-field__fill-input,
.fm-review-field--align-right .fm-review-field__sample,
.fm-review-field--align-right .fm-review-field__placeholder,
.fm-review-field--align-right .fm-review-field__fill-input,
.fm-review-field--centered .fm-review-field__sample,
.fm-review-field--centered .fm-review-field__placeholder,
.fm-review-field--centered .fm-review-field__fill-input,
.fm-review-field.is-resizing .fm-review-field__sample,
.fm-review-field.is-resizing .fm-review-field__placeholder,
.fm-review-field.is-resizing .fm-review-field__fill-input {
  /* Block (not flex) so text-align positions glyphs correctly */
  display: block !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
}

.fm-review-field--align-left .fm-review-field__sample,
.fm-review-field--align-left .fm-review-field__placeholder,
.fm-review-field--align-left .fm-review-field__fill-input {
  text-align: left !important;
}

.fm-review-field--align-center .fm-review-field__sample,
.fm-review-field--align-center .fm-review-field__placeholder,
.fm-review-field--align-center .fm-review-field__fill-input,
.fm-review-field--centered .fm-review-field__sample,
.fm-review-field--centered .fm-review-field__placeholder,
.fm-review-field--centered .fm-review-field__fill-input,
.fm-review-field.is-resizing:not(.fm-review-field--money) .fm-review-field__sample,
.fm-review-field.is-resizing:not(.fm-review-field--money) .fm-review-field__placeholder,
.fm-review-field.is-resizing:not(.fm-review-field--money) .fm-review-field__fill-input {
  text-align: center !important;
}

.fm-review-field--align-right .fm-review-field__sample,
.fm-review-field--align-right .fm-review-field__placeholder,
.fm-review-field--align-right .fm-review-field__fill-input,
.fm-review-field--centered.fm-review-field--money .fm-review-field__sample,
.fm-review-field--centered.fm-review-field--money .fm-review-field__fill-input,
.fm-review-field.is-resizing.fm-review-field--money .fm-review-field__sample,
.fm-review-field.is-resizing.fm-review-field--money .fm-review-field__fill-input,
.fm-review-field--money.fm-review-field--align-right .fm-review-field__fill-input {
  text-align: right !important;
}

/*
 * Edge-only resize handles (no corner squares).
 * 11pt line boxes are ~13px tall at 115% zoom — a 12px full-span bar
 * covered the blank. Keep a 5px edge hit target mostly outside the plate
 * plus a 5px center grip that appears on hover/select.
 */
.fm-review-field__resize-handle {
  position: absolute;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  box-shadow: none;
  touch-action: none;
  z-index: 8;
  pointer-events: auto;
  opacity: 1;
}

.fm-review-field__resize-handle--n,
.fm-review-field__resize-handle--s,
.fm-review-field__resize-handle--e,
.fm-review-field__resize-handle--w {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

.fm-review-field__resize-handle--n,
.fm-review-field__resize-handle--s {
  left: 10px;
  right: 10px;
  width: auto;
  height: var(--fm-resize-handle-thickness);
  cursor: ns-resize;
}
.fm-review-field__resize-handle--n {
  top: -3px;
}
.fm-review-field__resize-handle--s {
  bottom: -3px;
  top: auto;
}

.fm-review-field__resize-handle--e,
.fm-review-field__resize-handle--w {
  top: 10px;
  bottom: 10px;
  height: auto;
  width: var(--fm-resize-handle-thickness);
  cursor: ew-resize;
}
.fm-review-field__resize-handle--e {
  right: -3px;
  left: auto;
}
.fm-review-field__resize-handle--w {
  left: -3px;
}

.fm-review-field__resize-handle--n::after,
.fm-review-field__resize-handle--s::after,
.fm-review-field__resize-handle--e::after,
.fm-review-field__resize-handle--w::after {
  content: "";
  position: absolute;
  width: var(--fm-resize-grip-size);
  height: var(--fm-resize-grip-size);
  background: rgba(51, 65, 85, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
}
.fm-review-field__resize-handle--n::after,
.fm-review-field__resize-handle--s::after {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.fm-review-field__resize-handle--e::after,
.fm-review-field__resize-handle--w::after {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.fm-review-field:hover .fm-review-field__resize-handle--n::after,
.fm-review-field:hover .fm-review-field__resize-handle--s::after,
.fm-review-field:hover .fm-review-field__resize-handle--e::after,
.fm-review-field:hover .fm-review-field__resize-handle--w::after,
.fm-review-field.is-active .fm-review-field__resize-handle--n::after,
.fm-review-field.is-active .fm-review-field__resize-handle--s::after,
.fm-review-field.is-active .fm-review-field__resize-handle--e::after,
.fm-review-field.is-active .fm-review-field__resize-handle--w::after,
.fm-review-field.is-resizing .fm-review-field__resize-handle--n::after,
.fm-review-field.is-resizing .fm-review-field__resize-handle--s::after,
.fm-review-field.is-resizing .fm-review-field__resize-handle--e::after,
.fm-review-field.is-resizing .fm-review-field__resize-handle--w::after {
  opacity: 1;
}

/* Form Mapper: keep edges transparent; pin the small size over CW chrome. */
body.fm-mapper-cw-match .fm-review-field__resize-handle--n,
body.fm-mapper-cw-match .fm-review-field__resize-handle--s,
body.fm-mapper-cw-match .fm-review-field__resize-handle--e,
body.fm-mapper-cw-match .fm-review-field__resize-handle--w {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  display: block !important;
}
body.fm-mapper-cw-match .fm-review-field__resize-handle--n,
body.fm-mapper-cw-match .fm-review-field__resize-handle--s {
  height: var(--fm-resize-handle-thickness) !important;
  width: auto !important;
  left: 10px !important;
  right: 10px !important;
}
body.fm-mapper-cw-match .fm-review-field__resize-handle--e,
body.fm-mapper-cw-match .fm-review-field__resize-handle--w {
  width: var(--fm-resize-handle-thickness) !important;
  height: auto !important;
  top: 10px !important;
  bottom: 10px !important;
}

body.fm-mapper-cw-match .fm-review-field__delete {
  display: none !important;
}

body.fm-mapper-cw-match .fm-review-field:focus,
body.fm-mapper-cw-match .fm-review-field:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.fm-review-field__font-size-select {
  position: absolute;
  left: -4px;
  bottom: -22px;
  width: 52px;
  height: 20px;
  padding: 0 14px 0 4px;
  border-radius: 4px;
  border: 1px solid #0f766e;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  font-size: 0.62rem;
  font-weight: 700;
  color: #111827;
  z-index: 6;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.12s ease;
  cursor: pointer;
}

.fm-review-field.is-active .fm-review-field__font-size-select,
.fm-review-field:hover .fm-review-field__font-size-select {
  opacity: 1;
}

.fm-review-field.is-active .fm-review-field__font-size-select {
  border-color: #047857;
}

/* On-box text-align dropdown removed (use right panel Text pos / Align instead). */
.fm-review-field__text-align-select {
  display: none !important;
}

/* On-box L|C|R controls removed — text position is set from the right field list only. */

.fm-review-field__font-resize-handle {
  display: none;
}

.cw-calibrate-marker.is-dragging {
  cursor: grabbing;
  z-index: 6;
}

.cw-calibrate-marker {
  touch-action: none;
  user-select: none;
}

.fm-review-field:hover {
  z-index: 3;
}

.fm-review-field.is-active {
  z-index: 5;
}

/* Brief pulse when jumping from the sidebar list → PDF location */
.fm-review-field.is-reveal-pulse .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field.is-reveal-pulse .fm-review-field__body {
  animation: fm-field-reveal-pulse 1.1s ease-out 1;
  z-index: 8;
}

@keyframes fm-field-reveal-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55);
    border-color: #2563eb !important;
  }
  45% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.2);
    border-color: #1d4ed8 !important;
  }
  100% {
    box-shadow: none;
  }
}

.fm-review-field.is-active .fm-review-field__body {
  /* Selected: darker grey only — no green. */
  outline: none;
  outline-offset: 0;
  border-width: 1.75px;
  border-color: rgba(15, 23, 42, 0.98);
  background: var(--fm-field-wash-active) !important;
  box-shadow: 0 0 0 1px rgba(30, 41, 59, 0.55);
  cursor: grab;
}

.fm-review-field.is-active.is-dragging .fm-review-field__body {
  cursor: grabbing;
}

.fm-review-field__move {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 14px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 10px;
  line-height: 1;
  cursor: grab;
  opacity: 0.72;
}

.fm-review-field:hover .fm-review-field__move,
.fm-review-field.is-active .fm-review-field__move {
  opacity: 1;
}

.fm-review-field.is-dragging .fm-review-field__move {
  cursor: grabbing;
}

.fm-review-field__drag-strip {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 10px;
  z-index: 3;
  cursor: grab;
  /* No bold side band — transparent hit target only */
  background: transparent;
  border-radius: 2px 0 0 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: auto;
}

/* Compact drag grip inside the field box */
.fm-review-field__move-handle {
  position: absolute;
  top: 1px;
  left: 1px;
  transform: none;
  width: 7px;
  height: calc(100% - 2px);
  max-height: 12px;
  min-height: 8px;
  z-index: 4;
  border-radius: 2px;
  border: 0;
  background: rgba(37, 99, 235, 0.85);
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: auto;
}

.fm-review-field__move-handle::before {
  content: "";
  position: absolute;
  inset: 2px 1px;
  background:
    radial-gradient(circle, #fff 0.65px, transparent 0.75px) 0 0 / 100% 3px,
    radial-gradient(circle, #fff 0.65px, transparent 0.75px) 0 1.5px / 100% 3px;
  opacity: 0.95;
}

.fm-review-field.is-draggable .fm-review-field__body,
.fm-review-field--map.is-draggable .fm-review-field__body {
  padding-left: 9px;
}

.fm-review-field:hover .fm-review-field__drag-strip,
.fm-review-field.is-active .fm-review-field__drag-strip,
.fm-review-field:hover .fm-review-field__move-handle,
.fm-review-field.is-active .fm-review-field__move-handle {
  opacity: 1;
}

.fm-review-field.is-dragging .fm-review-field__drag-strip {
  cursor: grabbing;
  background: linear-gradient(90deg, rgba(198, 40, 40, 0.34), rgba(198, 40, 40, 0.08));
}

.fm-review-field.is-dragging .fm-review-field__move-handle {
  cursor: grabbing;
  background: #b42318;
}

.fm-review-field__role {
  position: absolute;
  top: -13px;
  left: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: calc(100% + 24px);
  padding: 0 0 0 4px;
  border-radius: 2px;
  background: #3b82f6;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

.fm-review-field__role-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
  cursor: grab;
}

.fm-review-field__role-input {
  flex: 1 1 auto;
  min-width: 5rem;
  max-width: 14rem;
  height: 14px;
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: 2px;
  background: #fff;
  color: #1f2937;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
}

.fm-review-field__rename {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
}

.fm-review-field:hover .fm-review-field__rename,
.fm-review-field.is-active .fm-review-field__rename {
  opacity: 1;
}

.fm-review-field__rename:hover {
  background: rgba(255, 255, 255, 0.28);
}

.fm-review-field__delete {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.fm-review-field:hover .fm-review-field__delete,
.fm-review-field.is-active .fm-review-field__delete {
  opacity: 1;
}

.fm-review-field__delete:hover {
  background: #b42318;
}

.fm-review-field.is-active .fm-review-field__role {
  background: #c62828;
}

/*
 * Line boxes: stored height still reaches the write-line (gold y/h).
 * Paint the plate 1.8pt short so the printed underline stays visible.
 * Checkboxes / tall bodies keep a full plate. Mapper-only — CW is ink-only.
 */
body.fm-mapper-cw-match .fm-review-field--text .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--money .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--datetime .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--signature .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--initials .fm-review-field__body {
  height: calc(100% - var(--fm-above-line-seat)) !important;
  max-height: calc(100% - var(--fm-above-line-seat)) !important;
  min-height: 0 !important;
  align-self: flex-start;
}

.fm-review-field__body {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: inherit;
  /* Dark grey outline — stands out; no green. */
  border: 1.75px solid rgba(30, 41, 59, 0.95);
  border-radius: 0;
  background: var(--fm-field-wash);
  box-shadow: none;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 4px;
  overflow: hidden;
}

.fm-review-field__label {
  display: none;
}

.fm-review-field__name {
  position: absolute;
  top: -11px;
  left: 0;
  z-index: 1;
  max-width: calc(100% + 48px);
  padding: 0 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.96);
  color: #1e3a5f;
  border: 1px solid rgba(30, 58, 95, 0.28);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
}

.fm-review-field__name.is-system {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #334155;
}

.fm-review-field.is-active .fm-review-field__name {
  background: #e2e8f0;
  border-color: #64748b;
  color: #0f172a;
}

.fm-review-field__name-input {
  position: absolute;
  top: -12px;
  left: 0;
  z-index: 2;
  min-width: 6rem;
  max-width: calc(100% + 48px);
  height: 14px;
  margin: 0;
  padding: 0 4px;
  border: 1px solid #ef6c00;
  border-radius: 2px;
  background: #fff;
  color: #1f2937;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.fm-review-field--map .fm-review-field__body {
  border-color: rgba(30, 41, 59, 0.95);
  border-width: 1.75px;
  background: var(--fm-field-wash);
  box-shadow: none;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0 1px;
  min-height: 0;
  cursor: grab;
}

.fm-review-field--map .fm-review-field__fill-input,
.fm-review-field--map .fm-review-field__fill-checkbox,
.fm-review-field--map .fm-review-field__sample,
.fm-review-field--map .fm-review-field__placeholder {
  pointer-events: none;
}

.fm-review-field--map .fm-review-field__fill-input:focus,
.fm-review-field--map .fm-review-field__fill-checkbox:focus {
  pointer-events: auto;
}

.fm-review-field--map.is-drag-pending .fm-review-field__fill-input,
.fm-review-field--map.is-drag-pending .fm-review-field__fill-checkbox,
.fm-review-field--map.is-dragging .fm-review-field__fill-input,
.fm-review-field--map.is-dragging .fm-review-field__fill-checkbox {
  pointer-events: none;
}

.fm-review-field--map.is-dragging .fm-review-field__body,
.fm-review-field--map.is-dragging .fm-review-field__fill-input {
  cursor: grabbing;
}

.fm-review-field--map.is-dragging .fm-review-field__fill-input,
.fm-review-field--map.is-dragging .fm-review-field__fill-checkbox {
  pointer-events: none;
}

body.fm-field-drag-active,
body.fm-field-drag-pending {
  user-select: none;
  cursor: grabbing;
}

body.fm-field-drag-active .fm-review-field.is-dragging,
body.fm-field-drag-pending .fm-review-field.is-drag-pending {
  cursor: grabbing;
}

body.fm-field-drag-active .fm-review-canvas-scroll,
body.fm-field-drag-pending .fm-review-canvas-scroll,
body.fm-field-resize-active .fm-review-canvas-scroll {
  /* Lock contract PDF under the field while moving / resizing */
  touch-action: none;
  overscroll-behavior: none;
  scroll-behavior: auto !important;
  overflow-anchor: none !important;
  /* Hard pin — wheel/trackpad cannot pan the form mid-gesture */
  overflow-y: hidden !important;
}

/* Field open for edit: no auto scroll-anchoring / smooth jump on either column */
body.fm-field-edit-session .fm-review-canvas-scroll,
body.fm-field-edit-session .cw-map-preview-dialog__sidebar-scroll,
body.fm-field-edit-session .fm-review-sidebar-scroll {
  overflow-anchor: none !important;
  scroll-behavior: auto !important;
}

body.fm-field-edit-session .cw-map-preview-field-item.is-active {
  /* Keep the open card visually stable */
  scroll-margin: 0;
}

/* Pause form ↔ sidebar list sync while a box is moving */
body.fm-field-drag-active .cw-map-preview-dialog__sidebar-scroll {
  pointer-events: none;
}

.fm-review-field--map.fm-review-field--money .fm-review-field__body,
.fm-review-field--map.fm-review-field--datetime .fm-review-field__body,
.fm-review-field--map.fm-review-field--signature .fm-review-field__body,
.fm-review-field--map.fm-review-field--initials .fm-review-field__body,
.fm-review-field--map.fm-review-field--checkbox .fm-review-field__body,
.fm-review-field--map.fm-review-field--text .fm-review-field__body {
  border-color: rgba(30, 41, 59, 0.95);
  background: var(--fm-field-wash);
}

.fm-review-field--underline .fm-review-field__body,
.fm-review-field--map.fm-review-field--underline .fm-review-field__body {
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 1px 1px;
}

.fm-review-field--underline .fm-review-field__sample,
.fm-review-field--underline .fm-review-field__fill-input,
.fm-review-field--underline .fm-review-field__fill-input--date {
  display: block;
  align-items: flex-end;
  height: auto;
  line-height: 1;
}

/*
 * Date fields: text sits on the BOTTOM of the box so it matches the form underline.
 * Overrides stretch/flex-start rules that left dates floating mid-box.
 */
.fm-review-field--datetime .fm-review-field__body,
.fm-review-field--map.fm-review-field--datetime .fm-review-field__body,
.fm-review-field--underline.fm-review-field--datetime .fm-review-field__body,
.fm-review-field--map.fm-review-field--underline.fm-review-field--datetime .fm-review-field__body {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-end !important;
  padding: 0 2px 1px !important;
  gap: 0 !important;
}

.fm-review-field--datetime .fm-review-field__sample,
.fm-review-field--datetime .fm-review-field__sample--datetime,
.fm-review-field--datetime .fm-review-field__fill-input,
.fm-review-field--datetime .fm-review-field__fill-input--date,
.fm-review-field--map.fm-review-field--datetime .fm-review-field__sample,
.fm-review-field--map.fm-review-field--datetime .fm-review-field__sample--datetime,
.fm-review-field--map.fm-review-field--datetime .fm-review-field__fill-input,
.fm-review-field--map.fm-review-field--datetime .fm-review-field__fill-input--date {
  display: block !important;
  flex: 0 0 auto !important;
  align-self: stretch !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  margin-top: auto !important;
  padding: 0 1px 0 !important;
  line-height: 1 !important;
  vertical-align: bottom;
}

.fm-review-field--datetime.is-resizing .fm-review-field__body,
.fm-review-field--map.fm-review-field--datetime.is-resizing .fm-review-field__body {
  align-items: stretch !important;
  justify-content: flex-end !important;
  padding-top: 0 !important;
}

.fm-review-field--datetime.is-resizing .fm-review-field__sample,
.fm-review-field--datetime.is-resizing .fm-review-field__fill-input,
.fm-review-field--datetime.is-resizing .fm-review-field__fill-input--date {
  display: block !important;
  height: auto !important;
  align-items: flex-end !important;
}

.fm-review-field--map .fm-review-field__fill-input,
.fm-review-field--map .fm-review-field__sample,
.fm-review-field--map .fm-review-field__fill-input--date {
  background: transparent;
  color: #1e3a5f;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 0 4px rgba(255, 255, 255, 0.65);
}

.fm-review-field--map .fm-review-field__format-select {
  background: rgba(255, 255, 255, 0.85);
  color: #14532d;
}

.fm-review-field__sample,
.fm-review-field__placeholder {
  display: block;
  color: #3b82f6;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Vertical mid is on the body flex; keep sample/input as block for text-align. */
.fm-review-field--centered .fm-review-field__sample,
.fm-review-field--centered .fm-review-field__fill-input,
.fm-review-field.is-resizing .fm-review-field__sample,
.fm-review-field.is-resizing .fm-review-field__fill-input {
  display: block;
  line-height: 1;
}

.fm-review-field--autofit .fm-review-field__sample,
.fm-review-field--autofit .fm-review-field__fill-input,
.fm-review-field--autofit .fm-review-field__fill-input--date,
.fm-review-field.is-resizing.fm-review-field--autofit .fm-review-field__sample,
.fm-review-field.is-resizing.fm-review-field--autofit .fm-review-field__fill-input {
  font-size: var(--fm-field-font-size, 9px) !important;
  line-height: 1;
}

.fm-review-field--autofit.fm-review-field--centered .fm-review-field__body {
  align-items: center;
  justify-content: flex-start;
}

.fm-review-field__placeholder {
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #5e35b1;
}

.fm-review-field__checkbox-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1e293b;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.fm-review-field__checkbox-mark.is-checked {
  color: #0f172a;
  background: transparent;
}

.fm-review-field__fill-select {
  flex: 0 0 auto;
  height: 14px;
  max-width: 3.4rem;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.fm-review-field__fill-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #374151;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 600;
  line-height: 1.15;
  cursor: grab;
  user-select: text;
}

.fm-review-field__fill-input:focus {
  cursor: text;
}

.fm-review-field__fill-input--money {
  text-align: right;
}

.fm-review-field__fill-input--date {
  font-size: 10px;
  padding: 0 1px;
  cursor: grab;
  touch-action: none;
  background: transparent;
  color: #14532d;
  border: 0;
  border-radius: 0;
  /* Kill native date-input calendar glyph if type=date ever reappears */
  -webkit-appearance: none;
  appearance: none;
}

.fm-review-field__fill-input--date::-webkit-calendar-picker-indicator,
.fm-review-field__fill-input--date::-webkit-inner-spin-button,
.fm-review-field__fill-input--date::-webkit-clear-button {
  display: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
}

.fm-review-field--datetime .fm-review-field__fill-input--date {
  background: transparent;
  color: #14532d;
  border-radius: 0;
}

.fm-review-field--map.fm-review-field--datetime .fm-review-field__sample--datetime {
  display: block;
  width: 100%;
  border-radius: 0;
}

.fm-review-field__fill-checkbox {
  /* Match other field greys — kill native white/black OS checkbox chrome */
  -webkit-appearance: none !important;
  appearance: none !important;
  display: block;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1.75px solid #1e293b !important;
  border-radius: 0 !important;
  background: var(--fm-field-wash) !important;
  accent-color: #1e293b;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none !important;
  outline: none !important;
}

.fm-review-field__fill-checkbox:checked {
  background: var(--fm-field-wash-checked) !important;
  border-color: #0f172a !important;
  background-image: linear-gradient(to top left, transparent 44%, #0f172a 46%, #0f172a 54%, transparent 56%),
    linear-gradient(to top right, transparent 44%, #0f172a 46%, #0f172a 54%, transparent 56%) !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
}

.fm-review-field--fill-now .fm-review-field__body {
  cursor: grab;
}

/* Fill now: only the input on the PDF — no role bar, labels, or box chrome */
.fm-review-field--fill-now-live {
  cursor: grab;
}

.fm-review-field--fill-now-live .fm-review-field__body {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  padding: 0;
  overflow: visible;
}

.fm-review-field--fill-now-live.fm-review-field--text .fm-review-field__body,
.fm-review-field--fill-now-live.fm-review-field--money .fm-review-field__body,
.fm-review-field--fill-now-live.fm-review-field--datetime .fm-review-field__body {
  border: 0;
  background: transparent;
}

/* Checkboxes always keep the same grey box as other mapped fields */
.fm-review-field--fill-now-live.fm-review-field--checkbox .fm-review-field__body,
.fm-review-field--map.fm-review-field--checkbox .fm-review-field__body,
.fm-review-field--checkbox .fm-review-field__body {
  border: 1.75px solid #1e293b !important;
  background: var(--fm-field-wash) !important;
  box-shadow: none !important;
  outline: none !important;
}

.fm-review-field--fill-now-live:not(.is-active):not(:hover) .fm-review-field__resize-handle,
.fm-review-field--fill-now-live:not(.is-active):not(:hover) .fm-review-field__font-size-select,
.fm-review-field--fill-now-live:not(.is-active):not(:hover) .fm-review-field__text-align-select {
  display: none;
}

.fm-review-field--fill-now-live:not(.is-active):not(:hover) .fm-review-field__drag-strip,
.fm-review-field--fill-now-live:not(.is-active):not(:hover) .fm-review-field__move-handle {
  opacity: 0;
}

.fm-review-field--fill-now-live:hover .fm-review-field__drag-strip,
.fm-review-field--fill-now-live.is-active .fm-review-field__drag-strip,
.fm-review-field--fill-now-live:hover .fm-review-field__move-handle,
.fm-review-field--fill-now-live.is-active .fm-review-field__move-handle {
  opacity: 1;
}

.fm-review-field--fill-now-live .fm-review-field__fill-input {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  box-sizing: border-box;
  color: #3b82f6;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 600;
  line-height: 1.15;
  cursor: grab;
  pointer-events: none;
}

.fm-review-field--fill-now-live .fm-review-field__fill-input:focus {
  cursor: text;
  pointer-events: auto;
}

.fm-review-field--fill-now-live .fm-review-field__fill-input--money {
  text-align: right;
}

.fm-review-field--fill-now-live .fm-review-field__fill-input--date {
  cursor: grab;
  touch-action: none;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #263238;
  font-size: inherit;
  min-width: 0;
}

.fm-review-field--fill-now-live.fm-review-field--map .fm-review-field__fill-input,
.fm-review-field--fill-now-live.fm-review-field--map .fm-review-field__fill-input--date {
  background: transparent;
  color: #14532d;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 0 4px rgba(255, 255, 255, 0.65);
}

.fm-review-field--fill-now-live.fm-review-field--checkbox .fm-review-field__body {
  align-items: center;
  justify-content: center;
  border: 1.75px solid #1e293b !important;
  background: var(--fm-field-wash) !important;
}

.fm-review-field--fill-now-live .fm-review-field__fill-checkbox {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  cursor: pointer;
}

.fm-review-field__sample.is-fill-now {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.1rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  text-overflow: clip;
}

.fm-review-field--text .fm-review-field__role,
.fm-review-field--money .fm-review-field__role {
  background: #3b82f6;
}

.fm-review-field--text .fm-review-field__body,
.fm-review-field--money .fm-review-field__body {
  border-color: #ffb300;
  background: #fffde7;
  justify-content: flex-start;
}

.fm-review-field--money .fm-review-field__body {
  border-color: #43a047;
  background: #f1f8e9;
}

.fm-review-field--money .fm-review-field__role {
  background: #2e7d32;
}

.fm-review-field--datetime .fm-review-field__body {
  border-color: #66bb6a;
  background: #f1f8e9;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end; /* date on the form line at bottom of box */
  gap: 0;
  padding: 0 2px 1px;
}

.fm-review-field--datetime .fm-review-field__role {
  background: #2e7d32;
  flex: 0 0 auto;
  order: -1; /* role chip above date; date stays on bottom line */
}

.fm-review-field--datetime .fm-review-field__fill-input,
.fm-review-field--datetime .fm-review-field__sample--datetime {
  flex: 0 0 auto;
  min-height: 0;
  width: 100%;
  margin-top: auto;
  cursor: grab;
  touch-action: none;
}

.fm-review-field--datetime.is-dragging .fm-review-field__fill-input--date,
.fm-review-field--datetime.is-dragging .fm-review-field__sample--datetime {
  cursor: grabbing;
}

.fm-review-field--datetime .fm-review-field__drag-strip {
  height: 12px;
}

.fm-review-field--map.fm-review-field--datetime .fm-review-field__body {
  padding: 0 1px;
}

.fm-review-field--map.fm-review-field--datetime .fm-review-field__fill-input--date {
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.1;
}

.fm-review-field--map.fm-review-field--datetime .fm-review-field__sample--datetime {
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.1;
}

.fm-review-field__format-row {
  flex: 0 0 auto;
  width: 100%;
}

.fm-review-field__format-select {
  width: 100%;
  height: 11px;
  margin: 0;
  padding: 0 1px;
  border: 0;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.92);
  color: #374151;
  font-size: 7px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
}

.fm-review-field--datetime .fm-review-field__format-select {
  background: #e2e8f0;
  color: #1e293b;
}

.fm-review-date-format-preview {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Form order badge (PDF top→bottom) on form-mapper field list */
.fm-field-list-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.1rem;
  margin-right: 0.2rem;
  padding: 0 0.25rem;
  border-radius: 4px;
  background: #e0e7ff;
  color: #1e3a5f;
  font-size: 0.62rem;
  font-weight: 800;
  vertical-align: middle;
}

.cw-calibrate-field-btn.is-active .fm-field-list-order {
  background: #2563eb;
  color: #fff;
}

/* Date format dropdown under each date field in the form-mapper sidebar */
.fm-field-list-date-format {
  padding: 0.2rem 0.45rem 0.45rem 0.55rem;
}

.fm-field-list-date-format__label {
  display: grid;
  gap: 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
}

.fm-field-list-date-format__label select {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: #111827;
}

.fm-review-fill-mode-panel {
  margin-bottom: 0.65rem;
}

.fm-review-fill-mode {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.fm-review-fill-mode__option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.fm-review-fill-mode__option input {
  flex: 0 0 auto;
}

.fm-mapper__tool-rail-fill {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fm-mapper__tool-rail-roles--first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.fm-review-fill-now-panel {
  margin: 0.45rem 0 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-review-fill-now-toggle {
  margin-bottom: 0.35rem;
}

.fm-review-fill-now-input {
  min-height: 4.2rem;
  resize: vertical;
}

.fm-review-fill-now-hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
  line-height: 1.3;
}

.fm-review-page .cw-calibrate-canvas-stage {
  cursor: crosshair;
}

@media (max-width: 960px) {
  .fm-review-workspace {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    min-height: calc(100vh - 10.5rem);
  }

  .fm-review-main {
    min-height: 28rem;
  }

  .fm-review-fields-panel {
    max-height: 16rem;
  }

  .fm-review-form-header {
    grid-template-columns: 1fr;
  }

  .fm-review-form-header__nav {
    justify-self: start;
  }
}

.fm-review-form-badge {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fm-review-form-badge--mapped {
  background: #dcfae6;
  color: #067647;
}

.fm-review-form-badge--needs {
  background: #fef0c7;
  color: #b54708;
}

.fm-review-inspector {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-review-inspector h3 {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
}

.fm-review-inspector__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

/* Drawer + right-list field size sliders (width / height → saved with map) */
.fm-review-size-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.15rem 0 0.65rem;
  padding: 0.55rem 0.5rem 0.45rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: #f9fafb;
}

.fm-review-size-slider {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.fm-review-size-slider__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
}

.fm-review-size-slider__head .cw-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #374151;
}

.fm-review-size-slider__value {
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #111827;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 6px;
  padding: 0.08rem 0.4rem;
  min-width: 2.4rem;
  text-align: center;
}

.fm-review-size-slider__row {
  display: grid;
  grid-template-columns: 1.7rem 1fr 1.7rem 3.2rem;
  gap: 0.3rem;
  align-items: center;
}

.fm-review-size-slider__range {
  width: 100%;
  min-width: 0;
  height: 1.25rem;
  margin: 0;
  accent-color: #3b82f6;
  cursor: pointer;
}

.fm-review-size-slider__number {
  width: 100% !important;
  min-width: 0;
  padding: 0.25rem 0.25rem !important;
  font-size: 0.75rem !important;
  text-align: center;
}

.fm-review-size-step,
.cw-map-preview-field-item__size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.fm-review-size-step:hover,
.cw-map-preview-field-item__size-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
}

.fm-review-size-step:active,
.cw-map-preview-field-item__size-btn:active {
  background: #dbeafe;
}

.fm-review-size-sliders__hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.3;
  color: #6b7280;
}

.cw-map-preview-field-item__size {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0.2rem 0 0.15rem;
  padding: 0.4rem 0.45rem 0.35rem;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

/* Simple Left/Right/Up/Down + Narrower/Wider controls */
.cw-map-preview-field-item__ctrl-label {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #374151;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem;
}

.cw-map-preview-field-item__ctrl-vals {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
  font-size: 0.68rem;
}

.cw-map-preview-field-item__move-pad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.28rem;
}

.cw-map-preview-field-item__move-spacer {
  display: block;
  min-height: 0.1rem;
}

.cw-map-preview-field-item__move-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
}

.cw-map-preview-field-item__move-btn,
.fm-review-move-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  margin: 0;
  padding: 0.28rem 0.35rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.cw-map-preview-field-item__move-btn:hover,
.fm-review-move-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.cw-map-preview-field-item__move-btn:active,
.fm-review-move-btn:active {
  background: #dbeafe;
}

.fm-review-simple-title {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
}

.fm-review-simple-vals {
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
}

.fm-review-move-pad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.fm-review-move-spacer {
  display: block;
}

.fm-review-move-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.fm-review-move-simple,
.fm-review-size-simple {
  padding: 0.55rem 0.6rem 0.45rem;
}

.fm-review-move-simple {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.fm-review-size-simple {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 0.45rem;
}

.cw-map-preview-field-item__size-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6b7280;
}

/* Left / Top need a wider label than W / H */
.cw-map-preview-field-item__pos .cw-map-preview-field-item__size-row {
  grid-template-columns: 4.1rem 1fr;
}

.cw-map-preview-field-item__size-row span {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cw-map-preview-field-item__size-controls {
  display: grid;
  grid-template-columns: 1.55rem 1fr 1.55rem;
  gap: 0.25rem;
  align-items: center;
  min-width: 0;
}

.cw-map-preview-field-item__size-row input[type="range"] {
  width: 100%;
  min-width: 0;
  height: 1.1rem;
  margin: 0;
  accent-color: #3b82f6;
  cursor: pointer;
}

.cw-map-preview-field-item__size-btn {
  width: 1.55rem;
  height: 1.55rem;
  font-size: 0.95rem;
}

.cw-map-preview-field-item.is-active .cw-map-preview-field-item__size {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.25);
}

.cw-map-preview-field-item__pos {
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.28);
}

.cw-map-preview-field-item.is-active .cw-map-preview-field-item__pos {
  background: #f1f5f9;
  border-color: rgba(71, 85, 105, 0.4);
}

.fm-review-position-sliders {
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.28);
}

/* Sidebar: type + who fills/signs (e-sign assignment without using the PDF popover) */
.cw-map-preview-field-item__assign {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.35rem 0 0.25rem;
  padding: 0.45rem 0.5rem 0.4rem;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid rgba(234, 88, 12, 0.2);
}

.cw-map-preview-field-item.is-active .cw-map-preview-field-item__assign {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.28);
}

.cw-map-preview-field-item__assign .cw-map-preview-field-item__ctrl {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6b7280;
}

.cw-map-preview-field-item__assign .cw-map-preview-field-item__ctrl span {
  letter-spacing: 0.01em;
}

.cw-map-preview-field-item__assign select {
  width: 100%;
  font-weight: 600;
}

.cw-map-preview-field-item__assign-hint {
  margin: 0;
  font-size: 0.65rem;
  line-height: 1.35;
  font-weight: 600;
  color: #6b7280;
}

.cw-map-preview-field-item__assign-hint.is-fill-now {
  color: #2563eb;
}

.cw-map-preview-field-item__assign-hint.is-esign {
  color: #c2410c;
}

/*
 * Collapse unselected right-list field cards to a single compact row so the
 * sidebar stays short. Full editors (type, party, X/Y, W/H) open only when
 * a field is selected on the form or in the list.
 */
body.fm-mapper-cw-match .cw-map-preview-field-item--edit:not(.is-active) {
  padding: 0.2rem 0.35rem !important;
  gap: 0 !important;
  min-height: 0;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit:not(.is-active) .cw-map-preview-field-item__details {
  display: none !important;
}

/* Hide jump header when collapsed — summary is the only row */
body.fm-mapper-cw-match .cw-map-preview-field-item--edit:not(.is-active) .cw-map-preview-field-item__jump {
  display: none !important;
}

/*
 * Compact selected-field editor: fit name, type, party, value, font, move,
 * size, and remove without a tall scroll. Move + Size sit side-by-side.
 * Sticky pin keeps Move/Size under the cursor while nudging (list no longer jumps).
 */
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.28rem 0.35rem !important;
  gap: 0.15rem !important;
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

/* Jump header is redundant when details are open (name is in the form). */
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__jump {
  display: none !important;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.22rem 0.3rem;
  margin-top: 0;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  align-items: start;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__name,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__assign,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__edit,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__controls,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__check,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__remove {
  grid-column: 1 / -1;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__pos {
  grid-column: 1;
  margin: 0;
  padding: 0.28rem 0.3rem 0.25rem;
  gap: 0.18rem;
  border-radius: 6px;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__size--simple:not(.cw-map-preview-field-item__pos) {
  grid-column: 2;
  margin: 0;
  padding: 0.28rem 0.3rem 0.25rem;
  gap: 0.18rem;
  border-radius: 6px;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__assign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 0.3rem;
  margin: 0;
  padding: 0.28rem 0.3rem;
  border-radius: 6px;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__assign-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.58rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__ctrl-label {
  margin: 0;
  font-size: 0.65rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__ctrl-vals {
  font-size: 0.62rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__move-pad {
  gap: 0.16rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__move-row {
  gap: 0.16rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__move-btn {
  min-height: 1.45rem;
  padding: 0.12rem 0.2rem;
  font-size: 0.68rem;
  border-radius: 5px;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__name {
  margin: 0;
  gap: 0.05rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__name-input,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__edit {
  min-height: 1.45rem !important;
  font-size: 0.74rem !important;
  padding: 0.15rem 0.35rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__controls {
  gap: 0.2rem 0.3rem;
  margin-top: 0;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__ctrl .cw-input,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__assign select {
  min-height: 1.45rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.3rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__align-btn {
  min-width: 1.35rem;
  height: 1.45rem;
  font-size: 0.68rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__remove {
  margin-top: 0;
  padding: 0.12rem 0.35rem;
  font-size: 0.68rem;
  min-height: 1.35rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__summary {
  display: none;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0.12rem 0.05rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  align-items: center;
  gap: 0.35rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit:not(.is-active) .cw-map-preview-field-item__summary {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__summary {
  display: none !important;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__summary-order {
  flex: 0 0 auto;
  min-width: 1.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #3b82f6;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__summary-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__summary-meta {
  flex: 0 1 auto;
  max-width: 42%;
  font-size: 0.62rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit:not(.is-active):hover {
  background: #f9fafb;
  border-color: rgba(37, 99, 235, 0.25);
}

/* Tighter list spacing when many fields are collapsed */
body.fm-mapper-cw-match .cw-map-preview-page-section__list {
  gap: 0.28rem;
}

body.fm-mapper-cw-match .cw-map-preview-page-section:not(.is-visible-page) .cw-map-preview-field-item--edit:not(.is-active) {
  opacity: 0.72;
}



.fm-review-inspector-empty {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--muted, #6b7280);
}



.fm-review-type-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
}

.fm-review-type-btn,
.fm-review-preset-btn {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: #fff;
  padding: 0.45rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.fm-review-type-btn:hover,
.fm-review-preset-btn:hover {
  border-color: var(--accent, #3b82f6);
  background: #f9fafb;
}

.fm-review-type-btn.is-text {
  border-color: #93c5fd;
  color: #2563eb;
}

.fm-review-type-btn.is-money {
  border-color: #6ee7b7;
  color: #047857;
}

.fm-review-type-btn.is-strikethrough {
  border-color: #fca5a5;
  color: #b91c1c;
}

.fm-review-type-btn.is-initials {
  border-color: #a5b4fc;
  color: #4338ca;
}

.fm-review-type-btn.is-datetime {
  border-color: #86efac;
  color: #15803d;
}

.fm-review-type-btn.is-checkbox {
  border-color: #fcd34d;
  color: #b45309;
}

.fm-review-type-btn.is-signature {
  border-color: #c4b5fd;
  color: #6d28d9;
}

.fm-review-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.fm-review-preset-btn {
  padding: 0.28rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 500;
}

.fm-review-delete-btn {
  width: 100%;
}

.fm-review-type-chip {
  display: inline-block;
  margin-right: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
}

.fm-review-type-chip--text {
  background: #dbeafe;
  color: #2563eb;
}

.fm-review-type-chip--money {
  background: #d1fae5;
  color: #047857;
}

.fm-review-type-chip--strikethrough {
  background: #fee2e2;
  color: #b91c1c;
}

.fm-review-type-chip--datetime {
  background: #dcfce7;
  color: #15803d;
}

.fm-review-type-chip--initials {
  background: #e0e7ff;
  color: #4338ca;
}

.fm-review-type-chip--checkbox {
  background: #fef3c7;
  color: #b45309;
}

.fm-review-type-chip--signature {
  background: #ede9fe;
  color: #6d28d9;
}

.fm-review-field--strikethrough {
  min-height: 10px !important;
}

.fm-review-field--strikethrough .fm-review-field__role {
  background: #c62828;
}

.fm-review-field--strikethrough .fm-review-field__body {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-height: 8px !important;
}

.fm-review-field__strike {
  display: block;
  width: 100%;
  height: 0;
  margin-top: 0.45rem;
  border-top: 2px solid #dc2626;
}

.fm-review-field--initials {
  min-width: 40px !important;
}

.fm-review-field--initials .fm-review-field__role {
  background: #4527a0;
}

.fm-review-field--initials .fm-review-field__body {
  border-color: #7e57c2;
  background: #ede7f6;
  justify-content: center;
}

.fm-review-field--initials .fm-review-field__sample,
.fm-review-field--initials .fm-review-field__placeholder {
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #4527a0;
}

.fm-review-field--checkbox {
  min-width: 0 !important;
  /* Do not cap at 16px — mapper size controls set width/height in PDF pts. */
  max-width: none;
}

.fm-review-field--checkbox .fm-review-field__role {
  background: #475569;
}

.fm-review-field--checkbox .fm-review-field__body {
  border-color: rgba(30, 41, 59, 0.95);
  background: var(--fm-field-wash);
  justify-content: center;
  align-items: center;
  padding: 0;
  border-radius: 0;
}

/* Multi-select marquee + selected field chrome */
.fm-review-overlay--marquee {
  cursor: crosshair;
}

.fm-marquee-select {
  position: absolute;
  z-index: 40;
  box-sizing: border-box;
  border: 1.5px dashed #3b82f6;
  background: rgba(37, 99, 235, 0.12);
  pointer-events: none;
}

.fm-review-field.is-selected:not(.is-active) .fm-review-field__body,
.fm-review-field.is-multi-selected .fm-review-field__body {
  box-shadow: 0 0 0 1.5px rgba(37, 99, 235, 0.65) !important;
  outline: none !important;
  background: rgba(255, 255, 255, 0.2) !important;
}

.fm-review-field.is-multi-selected.is-active .fm-review-field__body {
  box-shadow: 0 0 0 1.5px #2563eb !important;
  background: rgba(255, 255, 255, 0.28) !important;
}

.cw-map-preview-field-item.is-multi-selected,
.cw-map-preview-field-item.is-selected:not(.is-active) {
  border-color: #93c5fd !important;
  background: #eff6ff !important;
}

.fm-group-select-bar {
  position: absolute;
  top: 0.45rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  max-width: min(96%, 52rem);
  padding: 0.4rem 0.55rem;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: rgba(239, 246, 255, 0.97);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
}

.fm-group-select-bar[hidden] {
  display: none !important;
}

.fm-group-select-bar__count {
  font-size: 0.78rem;
  font-weight: 800;
  color: #2563eb;
  white-space: nowrap;
  margin-right: 0.15rem;
}

.fm-group-select-bar__field {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6b7280;
  margin: 0;
}

.fm-group-select-bar__field .cw-input {
  width: 4.2rem;
  min-height: 1.7rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.3rem;
}

.fm-group-select-bar__field select.cw-input {
  width: 6.5rem;
}

/* Signature height follows placement data (can be short signature lines). No 28px floor. */
.fm-review-field--signature {
  min-height: 0;
}

.fm-review-field--signature .fm-review-field__role {
  background: #6a1b9a;
}

.fm-review-field--signature .fm-review-field__body {
  border-color: rgba(171, 71, 188, 0.55);
  background: rgba(243, 229, 245, 0.18);
  justify-content: center;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0 2px;
}

.fm-review-field--signature.is-active,
.fm-review-field--initials.is-active {
  overflow: visible;
}

.fm-review-signature-hint {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  line-height: 1.35;
  color: #6a1b9a;
}

.fm-review-field-name-hint {
  margin: 0 0 0.45rem;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted, #6b7280);
}

.fm-review-field-name-status {
  margin: 0 0 0.5rem;
}

.fm-system-field-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.fm-system-field-badge.is-compact {
  margin-right: 0.25rem;
}

.fm-system-field-badge.is-known {
  background: #e8f5e9;
  color: #1b5e20;
}

.fm-system-field-badge.is-alias {
  background: #fff8e1;
  color: #e65100;
}

.fm-system-field-badge.is-custom {
  background: #ffebee;
  color: #b71c1c;
}

.fm-review-field--signature .fm-review-field__sample,
.fm-review-field--signature .fm-review-field__placeholder {
  font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive;
  font-style: italic;
  font-weight: 400;
  /* Follow box height — do not force 13px (that kept short H=4 signatures looking tall). */
  font-size: inherit;
  line-height: 1;
  max-height: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #6a1b9a;
}

/* ── Company library layout (forms left, editor right) ── */

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

.fm-library-shell {
  max-width: none;
  padding: 0;
  height: calc(100vh - 3.5rem);
  overflow: hidden;
}

body.fm-library-page {
  overflow-x: hidden;
  max-width: 100vw;
}

.fm-library-page .fm-library-shell,
.fm-library-page .fm-library,
.fm-library-page .fm-library__layout,
.fm-library-page .fm-library__editor,
.fm-library-page .fm-library__editor-body,
.fm-library-page .fm-mapper__canvas-wrap {
  overflow-x: hidden;
  max-width: 100%;
}

.fm-library-page .fm-library__layout {
  grid-template-columns: var(--dock-library-w, 17rem) minmax(0, 1fr);
}

.fm-library-page .fm-library__layout.is-library-right {
  grid-template-columns: minmax(0, 1fr) var(--dock-library-w, 17rem);
}

.fm-library-page [data-dock-panel="library"] {
  width: var(--dock-library-w, 17rem);
  min-width: 0;
  max-width: var(--dock-library-w, 17rem);
}

.fm-layout-dock-handle {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  cursor: grab;
  padding: 0.1rem 0.2rem;
  font-size: 0.82rem;
  line-height: 1;
  opacity: 0.55;
  color: #6b7280;
}

.fm-layout-dock-handle:hover {
  opacity: 1;
}

.fm-mapper__layout-sidebar .fm-layout-dock-handle,
.fm-mapper__page-rail .fm-layout-dock-handle {
  color: rgba(255, 255, 255, 0.78);
}

.fm-mapper__layout-sidebar-head,
.fm-mapper__page-rail-head,
.fm-library__sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.fm-mapper__layout-sidebar-head {
  justify-content: center;
}

.fm-mapper__page-rail-head {
  justify-content: center;
  padding: 0.15rem 0.1rem 0.35rem;
}

.fm-mapper__page-rail-head-label {
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

body.fm-layout-dock-active {
  cursor: grabbing;
  user-select: none;
}

body.fm-layout-dock-active .fm-layout-dock-handle {
  cursor: grabbing;
}

[data-dock-panel].is-dock-dragging {
  opacity: 0.78;
  outline: 2px dashed #3b82f6;
  outline-offset: 2px;
}

[data-dock-zone].is-dock-drop-target {
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.fm-mapper__canvas-wrap.is-page-rail-right {
  grid-template-columns: minmax(0, 1fr) var(--dock-page-rail-w, 3.25rem);
}

[data-dock-panel="page-rail"] {
  width: var(--dock-page-rail-w, 3.25rem);
  min-width: var(--dock-page-rail-w, 3.25rem);
  max-width: var(--dock-page-rail-w, 3.25rem);
}

.fm-layout-dock-hint {
  margin: 0 0 0.45rem;
  font-size: 0.66rem;
  color: #98a2b3;
  line-height: 1.35;
}

.fm-layout-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 6;
  cursor: col-resize;
  touch-action: none;
}

.fm-layout-resize-handle.is-edge-end {
  right: -3px;
}

.fm-layout-resize-handle.is-edge-start {
  left: -3px;
}

.fm-layout-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease;
}

.fm-layout-resize-handle:hover::after,
[data-dock-panel].is-dock-resizing .fm-layout-resize-handle::after {
  background: rgba(59, 130, 246, 0.55);
}

[data-dock-panel].has-layout-resize {
  position: relative;
}

[data-dock-panel].is-dock-resizing {
  outline: 1px solid rgba(59, 130, 246, 0.45);
  outline-offset: -1px;
}

body.fm-layout-resize-active {
  cursor: col-resize;
  user-select: none;
}

.fm-library {
  height: 100%;
}

.fm-library__layout {
  display: grid;
  grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.fm-library__sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 0.85rem 0.75rem 1rem;
  background: #f4f6f9;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  overflow-x: hidden;
  overflow-y: auto;
}

.fm-library__sidebar > * {
  min-width: 0;
  max-width: 100%;
}

.fm-library__sidebar > :not(.fm-library__list) {
  flex-shrink: 0;
}

.fm-library__sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.fm-library__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #374151;
}

.fm-library__links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.72rem;
  text-align: right;
}

.fm-library__links a {
  color: #3b82f6;
  text-decoration: none;
}

.fm-library__search {
  margin-bottom: 0.45rem;
}

.fm-library__filters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
  overflow: visible;
}

.fm-library__filters .cw-field {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
  overflow: visible;
}

.fm-library__filters .cw-input,
.fm-library__filters select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 2.35rem;
  box-sizing: border-box;
  -webkit-appearance: menulist;
  appearance: menulist;
}

.fm-library__mapped-toggle {
  flex: 0 0 auto;
  margin-bottom: 0;
  font-size: 0.78rem;
}

.fm-library__move-panel {
  margin: 0.55rem 0 0.35rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.95);
  overflow: hidden;
}

.fm-library__move-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.fm-library__move-summary::-webkit-details-marker {
  display: none;
}

.fm-library__move-summary::marker {
  content: "";
}

.fm-library__move-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #111827;
}

.fm-library__move-chevron {
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.fm-library__move-panel[open] .fm-library__move-chevron {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.fm-library__move-summary:hover .fm-library__move-title {
  color: #2563eb;
}

.fm-library__move-body {
  display: grid;
  gap: 0.45rem;
  padding: 0 0.65rem 0.6rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.fm-library__move-hint {
  margin: 0.45rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #6b7280;
}

.fm-library__move-panel .cw-field {
  margin: 0;
}

.fm-library__move-panel .cw-label {
  font-size: 0.68rem;
}

.fm-library__move-panel .cw-input,
.fm-library__move-panel select {
  font-size: 0.78rem;
}

.fm-library__move-panel .cw-btn {
  justify-self: start;
  margin-top: 0.1rem;
}

.fm-library__map-all {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.fm-library__map-all .cw-btn {
  flex: 1 1 auto;
}

.fm-batch-panel--review {
  margin-bottom: 0.45rem;
}

.fm-mapper__layout-btn--batch {
  margin-top: 0.25rem;
}

#fm-review-map-all:disabled,
#fm-review-map-all-map:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fm-library__scope {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  color: #6b7280;
  line-height: 1.3;
}

[data-dock-panel="library"] .fm-layout-resize-handle {
  display: none !important;
}

.fm-library__sidebar .fm-library__list {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.fm-library__sidebar .fm-library__list::-webkit-scrollbar {
  display: none;
}

.fm-library__list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.fm-library__section-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0.65rem 0 0.25rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  background: #eef2f6;
  border-radius: 4px;
}

.fm-library__section-head:first-child {
  margin-top: 0;
}

/* Active form pinned at the top of the Form library */
.fm-library__section-head--working {
  margin-top: 0;
  color: #1d4ed8;
  background: #dbeafe;
  letter-spacing: 0.04em;
}

.fm-library__item {
  margin: 0 0 0.35rem;
}

/* Keep the working form card visible under the sticky "Working on" head */
body.fm-mapper-cw-match #fm-review-all-forms-list > .fm-library__item.is-active:nth-child(2) {
  position: sticky;
  top: 1.75rem;
  z-index: 1;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
  border-radius: 6px;
}

.fm-library__item-skip {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0;
  padding: 0.28rem 0.45rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.fm-library__item-skip:hover {
  background: #eef2f6;
  color: #374151;
}

.fm-library__item-skip--restore {
  color: #3b82f6;
}

.fm-library__item-skip--restore:hover {
  background: #eef4ff;
  color: #1e3a5f;
}

.fm-review-pdf-loading {
  margin: 2rem auto;
  max-width: 24rem;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: #6b7280;
}

.fm-library__item-btn {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.fm-library__item-btn:hover {
  background: #eef4ff;
  border-color: #c7d7fe;
}

.fm-library__item-btn.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: inset 3px 0 0 #3b82f6;
}

/* Stronger “you are here” highlight for the open form in the left library */
body.fm-mapper-cw-match .fm-library__item.is-active .fm-library__item-btn,
body.fm-mapper-cw-match .fm-library__item-btn.is-active {
  background: #dbeafe !important;
  border-color: #3b82f6 !important;
  box-shadow: inset 3px 0 0 #3b82f6, 0 0 0 1px rgba(37, 99, 235, 0.18) !important;
}

body.fm-mapper-cw-match .fm-library__item.is-active .fm-library__item-title,
body.fm-mapper-cw-match .fm-library__item-btn.is-active .fm-library__item-title {
  color: #1e3a5f;
  font-weight: 800;
}

body.fm-mapper-cw-match .fm-library__item.is-active {
  position: relative;
}

.fm-library__item-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  color: #14171c;
}

.fm-library__item-meta {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.68rem;
  color: #6b7280;
}

.fm-library__item-meta--revision {
  color: #6b7280;
}

.fm-library__item-meta--revision.is-stale {
  color: #b42318;
  font-weight: 600;
}

.fm-form-revision {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
}

.fm-form-revision.is-stale {
  color: #b42318;
  font-weight: 600;
}

.fm-library__editor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #e5e7eb;
  flex: 1 1 auto;
}

.fm-library__editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.fm-library__editor-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  color: #14171c;
}

.fm-library__editor-meta {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  color: #6b7280;
}

.fm-library__editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.fm-library__edit-btn {
  padding: 0.42rem 1.15rem;
  border: 0;
  border-radius: 4px;
  background: #1e3a5f;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.fm-library__edit-btn:hover {
  background: #111827;
}

.fm-library__editor-body {
  display: grid;
  grid-template-columns: minmax(10.5rem, 13.5rem) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.fm-review-editor-body,
.cw-calibrate-editor-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.fm-review-editor-body > [data-dock-panel="layout"],
.cw-calibrate-editor-body > [data-dock-panel="layout"] {
  flex: 0 0 auto;
}

.fm-review-editor-body > [data-dock-fill="contract"],
.cw-calibrate-editor-body > [data-dock-fill="contract"] {
  flex: 1 1 auto;
  min-width: 11rem;
  width: 100%;
  max-width: 100%;
}

.fm-mapper__layout-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: var(--dock-layout-w, 7.25rem);
  max-width: var(--dock-layout-w, 7.25rem);
  flex: 0 0 var(--dock-layout-w, 7.25rem);
  max-height: 100%;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-mapper__edit-form-trigger {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 0.5rem 0.55rem 0.4rem;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: #1e3a5f;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.fm-mapper__edit-form-trigger:hover:not(:disabled) {
  background: #f4f6f8;
  color: #111827;
}

.fm-mapper__edit-form-trigger:disabled {
  opacity: 0.42;
  cursor: default;
}

.fm-mapper__layout-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.5rem 0.75rem;
  background: #1e3a5f;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.fm-mapper__layout-sidebar-head {
  margin: 0 0 0.15rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.fm-mapper__layout-section {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fm-mapper__layout-section--utils {
  border-bottom: 0;
  margin-top: auto;
}

.fm-mapper__layout-select-wrap {
  display: block;
  margin: 0;
}

.fm-mapper__layout-select {
  width: 100%;
  margin: 0;
  padding: 0.28rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
}

.fm-mapper__layout-btn--scan {
  background: rgba(46, 125, 50, 0.45);
  border-color: rgba(165, 214, 167, 0.45);
}

.fm-mapper__layout-btn--scan:hover:not(:disabled) {
  background: rgba(46, 125, 50, 0.62);
}

.fm-mapper__layout-section-label {
  margin: 0;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  text-align: center;
}

.fm-mapper__layout-roles {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
}

.fm-mapper__layout-sidebar .fm-mapper__role-btn {
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  text-align: center;
}

.fm-mapper__role-editor {
  margin-top: 0.15rem;
}

.fm-mapper__role-editor-summary {
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  list-style: none;
  text-align: center;
}

.fm-mapper__role-editor-summary::-webkit-details-marker {
  display: none;
}

.fm-mapper__role-editor[open] .fm-mapper__role-editor-summary {
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.35rem;
}

.fm-mapper__layout-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.fm-mapper__role-list--sidebar {
  margin-bottom: 0.35rem;
  gap: 0.28rem;
}

.fm-mapper__role-list--sidebar .fm-mapper__role-item {
  padding: 0.28rem 0.35rem;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.fm-mapper__role-list--sidebar .fm-mapper__role-item input {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.92);
}

.fm-mapper__role-list--sidebar .fm-mapper__role-remove {
  color: rgba(255, 255, 255, 0.45);
}

.fm-mapper__role-list--sidebar .fm-mapper__role-remove:hover {
  background: rgba(220, 38, 38, 0.25);
  color: #fecaca;
}

.fm-mapper__role-actions--sidebar {
  margin-bottom: 0;
  gap: 0.35rem;
}

.fm-mapper__checkbox-row--sidebar {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.72);
}

.fm-mapper__add-role--sidebar {
  font-size: 0.62rem;
  color: #93c5fd;
}

.fm-mapper__layout-sidebar .fm-mapper__role-btn.is-active {
  border-color: #93c5fd;
  background: rgba(100, 181, 246, 0.28);
  color: #fff;
}

.fm-mapper__layout-btn {
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.fm-mapper__layout-btn.is-active {
  border-color: #93c5fd;
  background: rgba(100, 181, 246, 0.22);
  color: #fff;
}

.fm-mapper__layout-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.fm-mapper__layout-btn--help {
  text-transform: none;
}

.fm-mapper__layout-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.fm-mapper__layout-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-height: 2.5rem;
  padding: 0.25rem 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.fm-mapper__layout-tool.is-selected {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.fm-mapper__layout-tool-glyph {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
}

.fm-mapper__layout-tool-name {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.fm-mapper__layout-tool.is-text { background: rgba(21, 101, 192, 0.35); }
.fm-mapper__layout-tool.is-money { background: rgba(46, 125, 50, 0.32); }
.fm-mapper__layout-tool.is-strikethrough { background: rgba(183, 28, 28, 0.3); }
.fm-mapper__layout-tool.is-checkbox { background: rgba(230, 81, 0, 0.3); }
.fm-mapper__layout-tool.is-signature { background: rgba(123, 31, 162, 0.32); }
.fm-mapper__layout-tool.is-initials { background: rgba(81, 45, 168, 0.3); }
.fm-mapper__layout-tool.is-datetime { background: rgba(56, 142, 60, 0.3); }

.fm-library__editor .fm-mapper__canvas-wrap {
  min-height: 0;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 0;
}

.fm-mapper__layout-sidebar:not(.is-active) {
  opacity: 0.45;
  pointer-events: none;
}

.fm-library__editor:not(:has(.fm-library__editor-body)) .fm-mapper__layout-sidebar {
  display: none;
}

.fm-library__editor-main {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  background: #fff;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.fm-library__editor-main > .fm-mapper__layout-workspace {
  flex: 1 1 auto;
  min-height: 0;
}

.fm-library__editor .fm-mapper__canvas-toolbar {
  flex-shrink: 0;
}

.fm-library__editor .fm-mapper__layout-workspace {
  flex: 1 1 auto;
  min-height: 0;
}

.fm-library__editor .fm-mapper__canvas-stage {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.fm-library__editor .fm-review-canvas-scroll {
  height: 100%;
}

.fm-library__field-drawer {
  flex: 0 0 min(15rem, 30vw);
  min-width: 12rem;
  max-width: 15rem;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.75rem 1rem;
  background: #fff;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
  overflow-y: auto;
  z-index: 4;
}

.fm-library__editor-main .fm-library__field-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  flex: none;
  width: var(--dock-drawer-w, 15rem);
  max-width: var(--dock-drawer-w, 15rem);
  min-width: 11.5rem;
}

.fm-library__editor-main.is-field-drawer-open > [data-dock-fill="pdf"],
.fm-library__editor-main.is-field-drawer-open > .fm-mapper__canvas-stage,
.fm-library__editor-main.is-field-drawer-open > .cw-calibrate-canvas-stage {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - var(--dock-drawer-w, 15rem));
}

.fm-library__editor-main.is-field-drawer-open .cw-calibrate-fields-column--dock-right {
  padding-right: 0.35rem;
}

.fm-library__field-drawer[hidden] {
  display: none !important;
}

.fm-library__field-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.fm-library__field-drawer-head h3 {
  margin: 0;
  font-size: 0.82rem;
}

.fm-library__field-count {
  color: #6b7280;
  font-weight: 600;
}

.fm-library__field-drawer-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #14171c;
}

.fm-library__field-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 0;
  border-radius: 4px;
  background: #1e3a5f;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: #fff;
}

.fm-library__field-drawer-close:hover {
  background: #111827;
}

.fm-field-edit-drawer__subtitle {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: #6b7280;
  flex-shrink: 0;
}

.fm-field-edit-drawer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.fm-library__field-drawer .fm-review-inspector {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.fm-field-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.fm-field-edit-modal[hidden] {
  display: none !important;
}

.fm-field-edit-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.fm-field-edit-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  padding: 1.2rem 1.35rem 1rem;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.fm-field-edit-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.fm-field-edit-modal__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 800;
}

.fm-field-edit-modal__subtitle {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: #6b7280;
}

.fm-field-edit-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-field-edit-modal .fm-review-inspector h4 {
  display: none;
}

.fm-mapper__util-btn.is-drawer-active,
.fm-mapper__menubar-btn.is-drawer-active {
  border-color: #93c5fd;
  background: rgba(100, 181, 246, 0.25);
  color: #fff;
}

.fm-library-page .fm-mapper__canvas.is-modal-open .fm-review-canvas-scroll {
  filter: brightness(0.72);
  pointer-events: none;
}

@media (max-width: 900px) {
  .fm-library__layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(10rem, 28vh) minmax(0, 1fr);
  }
}

/* ── Brokermint-style form mapper ── */

.fm-mapper-shell {
  max-width: none;
  padding: 0 0.75rem 0.75rem;
}

.fm-mapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 4.5rem);
  gap: 0.5rem;
}

.fm-mapper__header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  flex-shrink: 0;
}

.fm-mapper__header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fm-mapper__title {
  margin: 0;
  font-size: 1.15rem;
}

.fm-mapper__links {
  display: flex;
  gap: 0.85rem;
  font-size: 0.86rem;
}

.fm-mapper__links a {
  color: var(--accent, #3b82f6);
  text-decoration: none;
}

.fm-mapper__form-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.4rem 0.65rem;
  align-items: center;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.fm-mapper__form-info {
  min-width: 0;
}

.fm-mapper__form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.fm-mapper__workspace {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) minmax(0, 18rem);
  gap: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 12rem);
  max-height: calc(100vh - 12rem);
}

.fm-mapper__forms {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem 0.7rem;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.fm-mapper__forms.is-collapsed {
  display: none;
}

.fm-mapper__workspace:has(.fm-mapper__forms.is-collapsed) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
}

.fm-mapper__canvas-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.fm-mapper__layout-workspace {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.fm-mapper__canvas-column {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  background: #e5e7eb;
}

.fm-mapper__canvas-column .fm-mapper__canvas-stage {
  flex: 1 1 auto;
  min-height: 0;
}

/* Horizontal menu bar above PDF (Brokermint-style) */
.fm-mapper__pdf-menubar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.4rem 0.55rem;
  background: #1e3a5f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  z-index: 4;
}

.fm-mapper__menubar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.fm-mapper__menubar-group--tools {
  flex: 1 1 auto;
  min-width: min(100%, 16rem);
}

.fm-mapper__menubar-group--utils {
  flex: 0 0 auto;
  gap: 0.25rem;
}

.fm-mapper__menubar-label {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  flex: 0 0 auto;
}

.fm-mapper__menubar-divider {
  width: 1px;
  height: 1.65rem;
  background: rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
}

.fm-mapper__menubar-spacer {
  flex: 1 1 0.5rem;
  min-width: 0.25rem;
}

.fm-mapper__menubar-segmented {
  display: inline-flex;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.fm-mapper__menubar-btn {
  padding: 0.28rem 0.55rem;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.fm-mapper__menubar-segmented .fm-mapper__menubar-btn + .fm-mapper__menubar-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.fm-mapper__menubar-group--utils .fm-mapper__menubar-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

.fm-mapper__menubar-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.fm-mapper__menubar-btn.is-active {
  background: rgba(100, 181, 246, 0.28);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(100, 181, 246, 0.45);
}

.fm-mapper__menubar-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.fm-mapper__menubar-btn--help {
  min-width: 1.65rem;
  padding-inline: 0.35rem;
  text-align: center;
}

.fm-mapper__menubar-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
}

.fm-mapper__pdf-menubar .fm-mapper__role-btn {
  padding: 0.22rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  white-space: nowrap;
}

.fm-mapper__pdf-menubar .fm-mapper__role-btn:hover {
  border-color: #93c5fd;
  color: #fff;
}

.fm-mapper__pdf-menubar .fm-mapper__role-btn.is-active {
  border-color: #93c5fd;
  background: rgba(100, 181, 246, 0.28);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(100, 181, 246, 0.35);
}

.fm-mapper__menubar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  align-items: center;
}

.fm-mapper__menubar-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.22rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.fm-mapper__menubar-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.fm-mapper__menubar-tool.is-selected {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  background: rgba(100, 181, 246, 0.2);
}

.fm-mapper__menubar-tool-glyph {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.fm-mapper__menubar-tool-name {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.fm-mapper__menubar-tool.is-text { border-color: rgba(144, 202, 249, 0.5); background: rgba(21, 101, 192, 0.35); }
.fm-mapper__menubar-tool.is-money { border-color: rgba(165, 214, 167, 0.5); background: rgba(46, 125, 50, 0.32); }
.fm-mapper__menubar-tool.is-strikethrough { border-color: rgba(239, 154, 154, 0.5); background: rgba(183, 28, 28, 0.3); }
.fm-mapper__menubar-tool.is-checkbox { border-color: rgba(255, 204, 128, 0.5); background: rgba(230, 81, 0, 0.3); }
.fm-mapper__menubar-tool.is-signature { border-color: rgba(206, 147, 216, 0.5); background: rgba(123, 31, 162, 0.32); }
.fm-mapper__menubar-tool.is-initials { border-color: rgba(179, 157, 219, 0.5); background: rgba(81, 45, 168, 0.3); }
.fm-mapper__menubar-tool.is-datetime { border-color: rgba(165, 214, 167, 0.5); background: rgba(56, 142, 60, 0.3); }

.fm-mapper__menubar-btn.is-drawer-active {
  background: rgba(100, 181, 246, 0.35);
  border-color: #93c5fd;
  color: #fff;
}

.fm-mapper__tool-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  padding: 0.5rem 0.35rem 0.55rem;
  background: #1e3a5f;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  flex-shrink: 0;
}

.fm-mapper__tool-rail-head {
  margin: 0 0 0.15rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
}

.fm-mapper__tool-section {
  margin: 0.2rem 0 0;
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  text-align: center;
}

.fm-mapper__tool-section--role {
  margin-bottom: 0.15rem;
}

.fm-mapper__tool-rail-utils {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.fm-mapper__util-btn {
  width: 100%;
  padding: 0.3rem 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.15;
}

.fm-mapper__util-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.fm-mapper__util-btn.is-active {
  border-color: #93c5fd;
  background: rgba(100, 181, 246, 0.22);
  color: #fff;
}

.fm-mapper__util-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.fm-mapper__help-link {
  align-self: center;
  padding: 0.2rem 0.15rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  max-width: 3rem;
}

.fm-mapper__help-link:hover {
  color: #fff;
}

.fm-mapper__tool-rail-tools {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 0 0 auto;
}

.fm-mapper__tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 2.65rem;
  padding: 0.28rem 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.fm-mapper__tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.fm-mapper__tool-btn.is-selected {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  background: rgba(100, 181, 246, 0.18);
  border-color: #93c5fd;
}

.fm-mapper__tool-glyph {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.fm-mapper__tool-name {
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.1;
}

.fm-mapper__tool-btn.is-text { border-color: rgba(144, 202, 249, 0.45); background: rgba(21, 101, 192, 0.35); }
.fm-mapper__tool-btn.is-money { border-color: rgba(165, 214, 167, 0.45); background: rgba(46, 125, 50, 0.3); }
.fm-mapper__tool-btn.is-strikethrough { border-color: rgba(239, 154, 154, 0.45); background: rgba(183, 28, 28, 0.28); }
.fm-mapper__tool-btn.is-checkbox { border-color: rgba(255, 204, 128, 0.45); background: rgba(230, 81, 0, 0.28); }
.fm-mapper__tool-btn.is-signature { border-color: rgba(206, 147, 216, 0.45); background: rgba(123, 31, 162, 0.3); }
.fm-mapper__tool-btn.is-initials { border-color: rgba(179, 157, 219, 0.45); background: rgba(81, 45, 168, 0.28); }
.fm-mapper__tool-btn.is-datetime { border-color: rgba(165, 214, 167, 0.45); background: rgba(56, 142, 60, 0.28); }

.fm-mapper__tool-rail-roles {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fm-mapper__tool-rail .fm-mapper__role-choices {
  flex-direction: column;
  align-items: stretch;
}

.fm-mapper__tool-rail .fm-mapper__role-btn {
  width: 100%;
  text-align: center;
  font-size: 0.58rem;
  padding: 0.28rem 0.2rem;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  border-radius: 4px;
}

.fm-mapper__tool-rail .fm-mapper__role-btn:hover {
  border-color: #93c5fd;
  color: #fff;
}

.fm-mapper__tool-rail .fm-mapper__role-btn.is-active {
  border-color: #93c5fd;
  background: rgba(100, 181, 246, 0.25);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(100, 181, 246, 0.35);
}

/* Layout mode: PDF + full layout tool menu (Brokermint field placement view) */
.fm-mapper__canvas-wrap.is-layout-mode .fm-mapper__canvas-toolbar--legacy {
  display: none !important;
}

.fm-mapper__canvas-wrap.is-layout-mode .fm-review-status {
  position: absolute;
  left: 0.65rem;
  bottom: 0.45rem;
  z-index: 5;
  margin: 0;
  padding: 0.22rem 0.5rem;
  max-width: min(28rem, 70%);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  pointer-events: none;
}

.fm-mapper__canvas-wrap.is-layout-mode .fm-mapper__add-field-tab {
  display: none;
}

.fm-mapper__canvas-wrap.is-layout-mode .fm-library__editor-main {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.fm-mapper__canvas-wrap.is-layout-mode .fm-mapper__layout-workspace {
  flex: 1 1 auto;
}

.fm-mapper__canvas-wrap:not(.is-layout-mode) + .fm-mapper__layout-sidebar,
.fm-library__editor-body .fm-mapper__layout-sidebar {
  /* sidebar always visible when editor body present; dimmed via pointer-events when not mapping */
}

.fm-mapper__page-rail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem;
  background: #1e3a5f;
  border-radius: 8px 0 0 8px;
  align-items: stretch;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.fm-mapper__page-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3.5rem;
  padding: 0.35rem 0.2rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.2;
}

.fm-mapper__page-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.fm-mapper__page-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.fm-mapper__page-btn__num {
  font-size: 1.1rem;
  font-weight: 800;
}

.fm-mapper__canvas {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-radius: 0 8px 8px 0;
  overflow: hidden;
}

.fm-mapper__canvas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #f9fafb;
  flex-shrink: 0;
}

.fm-mapper__role-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.fm-mapper__role-bar-title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}

.fm-mapper__role-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.fm-mapper__role-btn {
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
}

.fm-mapper__role-btn:hover {
  border-color: #3b82f6;
  color: #1e3a5f;
}

.fm-mapper__role-btn.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1e3a5f;
  box-shadow: inset 0 0 0 1px rgba(21, 101, 192, 0.2);
}

.fm-mapper__wizard {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.fm-mapper__steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.fm-mapper__step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.5rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: #f9fafb;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
  cursor: pointer;
}

.fm-mapper__step.is-active {
  color: #1e3a5f;
  border-bottom-color: #3b82f6;
  background: #fff;
}

.fm-mapper__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #e8edf4;
  font-size: 0.68rem;
  font-weight: 800;
}

.fm-mapper__step.is-active .fm-mapper__step-num {
  background: #3b82f6;
  color: #fff;
}

.fm-mapper__wizard-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0.85rem 1rem;
}

.fm-mapper__wizard-heading {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text, #14171c);
}

.fm-mapper__toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: #f9fafb;
  font-size: 0.82rem;
  cursor: pointer;
}

.fm-mapper__role-list {
  list-style: none;
  margin: 0 0 0.55rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.fm-mapper__role-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  background: #fff;
}

.fm-mapper__role-item input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  padding: 0;
  font-size: 0.88rem;
  font-weight: 600;
  background: transparent;
  outline: none;
}

.fm-mapper__role-remove {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #98a2b3;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.fm-mapper__role-remove:hover {
  background: #fef2f2;
  color: #b42318;
}

.fm-mapper__role-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.fm-mapper__checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.fm-mapper__add-role {
  border: 0;
  background: transparent;
  color: #3b82f6;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.fm-mapper__next-btn {
  width: 100%;
  justify-content: center;
}

.fm-mapper__role-chip {
  display: inline-block;
  margin-right: 0.2rem;
  padding: 0.05rem 0.38rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a5f;
  font-size: 0.62rem;
  font-weight: 800;
  vertical-align: middle;
}

/* Brokermint-style floating party picker on the PDF canvas */
.fm-party-picker {
  position: fixed;
  z-index: 120;
  width: min(13.5rem, calc(100vw - 1.5rem));
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.16),
    0 2px 8px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  touch-action: manipulation;
}

.fm-party-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem 0.35rem 0.65rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: #f9fafb;
}

.fm-party-picker__title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #374151;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fm-party-picker__close {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.fm-party-picker__close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #111827;
}

.fm-party-picker__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: 16rem;
  overflow-y: auto;
}

.fm-party-picker__option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.fm-party-picker__option:hover,
.fm-party-picker__option.is-active {
  background: #f3f4f6;
}

.fm-party-picker__dot {
  flex: 0 0 auto;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: var(--party-color, #3b82f6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.fm-party-picker__label {
  flex: 1 1 auto;
  min-width: 0;
}

.fm-party-picker__check {
  flex: 0 0 auto;
  color: #3b82f6;
  font-size: 0.78rem;
  font-weight: 800;
}

.fm-party-picker__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem 0.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: #f9fafb;
}

.fm-party-picker__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 0.95rem;
  cursor: pointer;
}

.fm-party-picker__action:hover {
  background: #f3f4f6;
  border-color: rgba(37, 99, 235, 0.28);
}

.fm-party-picker__action--danger:hover {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.28);
  color: #b91c1c;
}

.fm-review-field__party-badge {
  position: absolute;
  top: -11px;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: calc(100% + 12px);
  padding: 0 0.35rem 0 0.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #111827;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
  pointer-events: none;
}

.fm-review-field__party-badge::before {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--party-color, #3b82f6);
}

.fm-review-field.is-active .fm-review-field__party-badge {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.fm-review-field--esign-marker .fm-review-field__role-text::before {
  content: "@ ";
  font-weight: 800;
  color: #3b82f6;
}

.fm-review-field--esign-marker {
  border-color: #93c5fd;
  background: rgba(227, 242, 253, 0.55);
}

.fm-review-field--esign-marker.fm-review-field--signature,
.fm-review-field--esign-marker.fm-review-field--initials {
  border-color: #93c5fd;
  background: rgba(227, 242, 253, 0.55);
}

.fm-review-field--fill-esign .fm-review-field__role {
  background: #5c6bc0;
}

.fm-review-field--fill-now .fm-review-field__role {
  background: #2e7d32;
}

.fm-review-field--esign-marker .fm-review-field__role {
  background: #3b82f6;
  color: #fff;
  font-size: 0.68rem;
}

.fm-review-field--esign-marker .fm-review-field__rename,
.fm-review-field--esign-marker .fm-review-field__delete {
  color: rgba(255, 255, 255, 0.85);
}

.fm-mapper__canvas-wrap.is-layout-mode .fm-review-page-label {
  display: block;
}

.fm-mapper__canvas-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.fm-mapper__add-field-tab {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  padding: 0.35rem 1.1rem;
  border: 0;
  border-radius: 0 0 6px 6px;
  background: #14171c;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}

.fm-mapper__add-field-tab:hover {
  background: #111827;
}

.fm-edit-form-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.fm-edit-form-modal[hidden] {
  display: none !important;
}

.fm-edit-form-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.fm-edit-form-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  max-height: min(90vh, 36rem);
  overflow-y: auto;
  padding: 1.35rem 1.5rem 1.1rem;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.fm-edit-form-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.fm-edit-form-modal__close:hover {
  background: #f3f4f6;
  color: #14171c;
}

.fm-edit-form-modal__title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.fm-edit-form-modal__question {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.4;
}

.fm-edit-form-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.fm-edit-form-modal__done {
  min-width: 5.5rem;
  justify-content: center;
}

.fm-edit-form-modal__step-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: #98a2b3;
  text-transform: lowercase;
}

.fm-edit-form-modal__next {
  min-width: 6.5rem;
  justify-content: center;
}

.fm-review-field__pencil {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.fm-review-field__pencil:hover {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

.fm-mapper__canvas.is-modal-open .fm-review-canvas-scroll {
  filter: brightness(0.72);
  pointer-events: none;
}

@media (max-width: 1100px) {
  .fm-mapper__workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: auto;
    max-height: none;
  }

  .fm-mapper__forms {
    max-height: 12rem;
  }

  .fm-mapper__wizard {
    max-height: 22rem;
  }

  .fm-mapper__canvas-wrap {
    min-height: 50vh;
  }
}
/* ==========================================================================
   Form Mapper ↔ Contract Writer review match
   Keep left form library; match PDF field chrome + right field list UX
   ========================================================================== */

body.fm-mapper-cw-match .fm-library__layout {
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
}

/* --------------------------------------------------------------------------
   Top bar + side panel pull-downs: Forms | Data fields | Actual PDF form
   -------------------------------------------------------------------------- */
.fm-panel-switch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
  padding: 0.55rem 0.75rem;
  margin: 0;
  background: linear-gradient(180deg, #1e3a8a 0%, #1d4ed8 100%);
  border-bottom: 2px solid #1e40af;
  color: #eff6ff;
  flex: 0 0 auto;
  z-index: 20;
}

.fm-panel-switch-bar__pair {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
}

.fm-panel-switch {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 11rem;
  flex: 1 1 12rem;
  max-width: 18rem;
}

.fm-panel-switch__side {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bfdbfe;
}

.fm-panel-switch__select {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  padding: 0.45rem 0.6rem !important;
  border-radius: 8px !important;
  border: 2px solid #93c5fd !important;
  background: #fff !important;
  color: #1e3a8a !important;
  min-height: 2.4rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.fm-panel-switch__select:focus {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.fm-panel-switch-bar__hint {
  margin: 0;
  flex: 1 1 14rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #dbeafe;
  max-width: 28rem;
}

.fm-panel-switch-bar__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.fm-panel-switch-bar__quick .cw-btn--secondary {
  background: #fbbf24 !important;
  border-color: #f59e0b !important;
  color: #78350f !important;
  font-weight: 700 !important;
}

.fm-panel-switch-bar__quick .cw-btn--ghost {
  color: #eff6ff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

.fm-side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Keep left sidebar head (Left pull-down) always visible — panes scroll inside */
body.fm-mapper-cw-match .fm-library__sidebar.fm-side-panel {
  overflow: hidden;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

body.fm-mapper-cw-match .fm-library__sidebar .fm-side-pane {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-bottom: 1rem;
}

.fm-side-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 5;
}

.fm-side-panel__head--right {
  background: linear-gradient(180deg, #eff6ff 0%, #e0f2fe 100%);
  border-bottom-color: #bfdbfe;
}

.fm-side-panel__view {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}

.fm-side-panel__view-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1e40af;
  white-space: nowrap;
}

.fm-side-panel__view-select {
  flex: 1 1 auto;
  min-width: 8.5rem;
  max-width: 100%;
  font-size: 0.8rem !important;
  font-weight: 600;
  padding: 0.28rem 0.45rem !important;
  border-radius: 8px !important;
  border-color: #60a5fa !important;
  background: #fff !important;
  color: #1e3a8a !important;
  cursor: pointer;
}

.fm-side-panel__links {
  flex: 0 0 auto;
  font-size: 0.75rem;
}

.fm-side-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.fm-side-pane[hidden] {
  display: none !important;
}

.fm-side-pane__subhead {
  padding: 0.35rem 0.55rem 0;
}

.fm-side-pane__hint {
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #4b5563;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
}

.fm-side-pane--pdf {
  background: #e5e7eb;
}

.fm-side-pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.5rem;
  background: #111827;
  color: #f9fafb;
  flex: 0 0 auto;
}

.fm-side-pdf-toolbar__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: auto;
}

.fm-side-pdf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  cursor: pointer;
  user-select: none;
}

.fm-side-pdf-toolbar .cw-btn {
  color: #e5e7eb;
  border-color: #4b5563;
}

.fm-side-pdf-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.45rem;
}

.fm-side-pdf-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.fm-side-pdf-page {
  position: relative;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  line-height: 0;
}

.fm-side-pdf-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.fm-side-pdf-page__overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fm-side-pdf-page__label {
  position: absolute;
  left: 0.25rem;
  top: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d1d5db;
  border-radius: 3px;
  padding: 0.05rem 0.28rem;
  line-height: 1.2;
  pointer-events: none;
  z-index: 2;
}

.fm-side-pdf-box {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid rgba(37, 99, 235, 0.9);
  background: rgba(59, 130, 246, 0.12);
  pointer-events: none;
}

.fm-side-pdf-box.is-active {
  border-color: #dc2626;
  background: rgba(248, 113, 113, 0.2);
  box-shadow: 0 0 0 1px #fecaca;
}

.fm-side-pdf-empty {
  margin: 1rem 0.5rem;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
  background: #fff;
  border-radius: 8px;
  border: 1px dashed #d1d5db;
  line-height: 1.4;
}

.fm-side-forms-mirror {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.25rem 0;
}

.fm-side-forms-mirror .fm-library__list {
  margin: 0;
}

.fm-side-fields-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.fm-panel-compare-hint {
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #4b5563;
  max-width: 36rem;
}

/* Widen side when showing PDF for easier visual comparison */
body.fm-left-pdf .fm-library__layout,
body.fm-right-pdf.fm-mapper-cw-match .fm-library__layout {
  /* keep default; side panel min width bumped below */
}

body.fm-left-pdf .fm-library__sidebar.fm-side-panel {
  min-width: 16rem;
  width: min(28vw, 22rem);
  max-width: 26rem;
}

body.fm-right-pdf.fm-mapper-cw-match .fm-review-fields-column.fm-side-panel {
  min-width: 16rem !important;
  width: min(28vw, 22rem) !important;
  max-width: 26rem !important;
  flex: 0 0 auto !important;
}

/* Blank-line gaps (no mapped field yet) — center map */
.fm-review-gap {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px dashed rgba(217, 119, 6, 0.95);
  background: rgba(251, 191, 36, 0.18);
  border-radius: 2px;
  pointer-events: none;
  z-index: 3;
}

.fm-review-gap__tag {
  position: absolute;
  left: 0;
  top: -1.05rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #92400e;
  background: rgba(254, 243, 199, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.65);
  border-radius: 3px;
  padding: 0.05rem 0.28rem;
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
}

.fm-gap-banner {
  display: none;
  margin: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #78350f;
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
}

body.fm-gaps-on .fm-gap-banner {
  display: block;
}

/* Editor: tools strip on top, then PDF | fields */
body.fm-mapper-cw-match .fm-library__editor-body.fm-review-editor-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.fm-mapper-cw-match .fm-mapper__layout-column {
  width: 100% !important;
  max-width: none !important;
  flex: 0 0 auto !important;
  border-right: none;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

body.fm-mapper-cw-match .fm-mapper__layout-sidebar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem 0.85rem;
  padding: 0.4rem 0.55rem 0.5rem;
  background: #f9fafb;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: none;
}

body.fm-mapper-cw-match .fm-mapper__layout-sidebar-head {
  display: none;
}

body.fm-mapper-cw-match .fm-mapper__layout-section {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.2rem 0.35rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

body.fm-mapper-cw-match .fm-mapper__layout-section-label {
  color: #6b7280 !important;
  font-size: 0.62rem !important;
  margin-bottom: 0.25rem !important;
}

body.fm-mapper-cw-match .fm-mapper__layout-tools {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem;
}

body.fm-mapper-cw-match .fm-mapper__layout-tool {
  min-width: 2.4rem;
  background: #fff;
  color: #374151;
  box-shadow: inset 0 0 0 1px #e5e7eb;
}

body.fm-mapper-cw-match .fm-mapper__layout-tool.is-selected,
body.fm-mapper-cw-match .fm-mapper__layout-tool.is-active,
body.fm-mapper-cw-match .fm-review-esign-tool.is-selected {
  background: #dbeafe;
  color: #2563eb;
  box-shadow: inset 0 0 0 1px #3b82f6;
}

body.fm-mapper-cw-match .fm-mapper__layout-btn {
  background: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
}

body.fm-mapper-cw-match .fm-mapper__layout-btn.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #2563eb;
}

body.fm-mapper-cw-match .fm-mapper__layout-roles,
body.fm-mapper-cw-match .fm-mapper__role-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

body.fm-mapper-cw-match .fm-mapper__role-editor-summary,
body.fm-mapper-cw-match .fm-mapper__layout-toggle-row,
body.fm-mapper-cw-match .fm-mapper__checkbox-row--sidebar {
  color: #6b7280;
}

/* PDF stage + right field list (CW-style) */
body.fm-mapper-cw-match .fm-mapper__canvas-wrap {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 18rem);
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
  position: relative;
}

body.fm-mapper-cw-match .fm-library__editor-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  grid-column: 1;
  grid-row: 1;
}

body.fm-mapper-cw-match .fm-mapper__canvas-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.fm-mapper-cw-match .fm-review-canvas-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #e8eaed;
  /* Vertical scrollbar only — contract scrolls down the form, not sideways */
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

body.fm-mapper-cw-match .fm-review-canvas-scroll::-webkit-scrollbar {
  width: 10px;
  height: 0;
}

body.fm-mapper-cw-match .fm-review-canvas-scroll::-webkit-scrollbar-track {
  background: transparent;
}

body.fm-mapper-cw-match .fm-review-canvas-scroll::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

body.fm-mapper-cw-match .fm-review-canvas-scroll::-webkit-scrollbar-thumb:hover {
  background: #64748b;
  background-clip: padding-box;
}

/* Right field list always visible */
body.fm-mapper-cw-match .fm-review-fields-column {
  display: flex !important;
  flex-direction: column;
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  width: auto !important;
  border-left: 1px solid #d1d5db;
  background: #f3f6fa;
  overflow: hidden;
  padding: 0.45rem 0.5rem 0.5rem;
}

body.fm-mapper-cw-match .fm-review-fields-column[hidden] {
  display: flex !important;
}

body.fm-mapper-cw-match .cw-calibrate-fields-column__head {
  flex: 0 0 auto;
  margin-bottom: 0.35rem;
}

body.fm-mapper-cw-match .cw-calibrate-fields-column__hint {
  flex: 0 0 auto;
  font-size: 0.7rem;
  color: #6b7280;
  margin: 0 0 0.4rem;
}

body.fm-mapper-cw-match .fm-review-field-list,
body.fm-mapper-cw-match .cw-calibrate-field-list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  list-style: none;
  margin: 0;
  padding: 0 0 1rem;
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

/* Whole-box drag — no grip handle (match CW) */
body.fm-mapper-cw-match .fm-review-field__move-handle,
body.fm-mapper-cw-match .fm-review-field__drag-strip {
  display: none !important;
}

body.fm-mapper-cw-match .fm-review-field.is-draggable .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map.is-draggable .fm-review-field__body {
  padding-left: 3px !important;
  cursor: grab;
}

body.fm-mapper-cw-match .fm-review-field--map {
  cursor: grab;
  touch-action: none;
}

body.fm-mapper-cw-match .fm-review-field--map.is-dragging {
  cursor: grabbing;
}

/*
 * ONE solid edge only on every PDF field box (all types / states).
 * No outline, no inset ring, no outer glow, no second border on inputs.
 */
body.fm-mapper-cw-match .fm-review-field,
body.fm-mapper-cw-match .fm-review-field--map {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--text .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--money .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--datetime .fm-review-field__body,
/* No green highlight — all states stay dark grey so the PDF stays readable */
body.fm-mapper-cw-match .fm-review-field--strikethrough .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--signature .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--initials .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--fill-now .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--fill-now-live .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field.is-active .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field.is-dragging .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field.is-drag-pending .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field.is-resizing .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map.is-active .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map.is-dragging .fm-review-field__body {
  border: 1.75px solid rgba(30, 41, 59, 0.95) !important;
  border-width: 1.75px !important;
  border-radius: 0 !important;
  background: var(--fm-field-wash) !important;
  box-shadow: none !important;
  outline: none !important;
  outline-offset: 0 !important;
}

body.fm-mapper-cw-match .fm-review-field.is-active .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map.is-active .fm-review-field__body {
  border-color: rgba(15, 23, 42, 0.98) !important;
  background: var(--fm-field-wash-active) !important;
  box-shadow: 0 0 0 1px rgba(30, 41, 59, 0.55) !important;
}

body.fm-mapper-cw-match .fm-review-field,
body.fm-mapper-cw-match .fm-review-field--map,
body.fm-mapper-cw-match .fm-review-field__fill-input,
body.fm-mapper-cw-match .fm-review-field__fill-input--date,
body.fm-mapper-cw-match .fm-review-field__fill-input--money,
body.fm-mapper-cw-match .fm-review-field__sample,
body.fm-mapper-cw-match .fm-review-field__sample--datetime,
body.fm-mapper-cw-match .fm-review-field__placeholder {
  border-radius: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
}

/* Offer date / all datetime: no rounded calendar icon inside the box */
body.fm-mapper-cw-match .fm-review-field--datetime .fm-review-field__fill-input--date,
body.fm-mapper-cw-match .fm-review-field--datetime .fm-review-field__sample--datetime {
  border-radius: 0 !important;
  background: transparent !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

body.fm-mapper-cw-match .fm-review-field__fill-input--date::-webkit-calendar-picker-indicator {
  display: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}

body.fm-mapper-cw-match .fm-review-field.is-active .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map.is-active .fm-review-field__body {
  border-color: rgba(15, 23, 42, 0.98) !important;
  background: var(--fm-field-wash-active) !important;
  box-shadow: 0 0 0 1px rgba(30, 41, 59, 0.55) !important;
}

body.fm-mapper-cw-match .fm-review-field.is-drag-pending .fm-review-field__body {
  border-style: dashed !important;
  border-color: rgba(30, 41, 59, 0.95) !important;
  background: var(--fm-field-wash) !important;
}

body.fm-mapper-cw-match .fm-review-field--strikethrough .fm-review-field__body {
  border-color: rgba(30, 41, 59, 0.95) !important;
  background: var(--fm-field-wash) !important;
  min-height: 16px !important;
  padding: 1px 3px !important;
}

body.fm-mapper-cw-match .fm-review-field--strikethrough.is-active .fm-review-field__body {
  border-color: rgba(15, 23, 42, 0.98) !important;
  background: var(--fm-field-wash-active) !important;
}

body.fm-mapper-cw-match .fm-review-field--signature,
body.fm-mapper-cw-match .fm-review-field--signature.fm-review-field--map {
  min-height: 0 !important;
}

body.fm-mapper-cw-match .fm-review-field--signature .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--initials .fm-review-field__body {
  border-color: rgba(30, 41, 59, 0.95) !important;
  background: var(--fm-field-wash) !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  padding: 0 2px !important;
}

body.fm-mapper-cw-match .fm-review-field--signature.is-active .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--initials.is-active .fm-review-field__body {
  border-color: rgba(15, 23, 42, 0.98) !important;
  background: var(--fm-field-wash-active) !important;
  min-height: 0 !important;
}

/* Short signature lines: don't let label text force the box taller */
body.fm-mapper-cw-match .fm-review-field--signature .fm-review-field__placeholder,
body.fm-mapper-cw-match .fm-review-field--signature .fm-review-field__sample {
  font-size: max(6px, 0.85em) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-height: 100% !important;
}

/* Checkboxes match other field greys (same slate as text/money boxes) */
body.fm-mapper-cw-match .fm-review-field--checkbox,
body.fm-mapper-cw-match .fm-review-field--checkbox.fm-review-field--map {
  min-width: 0 !important;
  max-width: 18px !important;
}

body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--checkbox.is-active .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--checkbox.is-dragging .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--checkbox.is-drag-pending .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--checkbox.is-resizing .fm-review-field__body,
body.fm-mapper-cw-match .fm-review-field--map.fm-review-field--checkbox .fm-review-field__body {
  border: 1.75px solid rgba(30, 41, 59, 0.95) !important;
  border-radius: 0 !important;
  background: var(--fm-field-wash) !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  justify-content: center !important;
  align-items: center !important;
}

body.fm-mapper-cw-match .fm-review-field--checkbox.is-active .fm-review-field__body {
  border-color: rgba(15, 23, 42, 0.98) !important;
  background: var(--fm-field-wash-active) !important;
  box-shadow: 0 0 0 1px rgba(30, 41, 59, 0.55) !important;
}

body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__checkbox-mark,
body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__fill-checkbox {
  color: #1e293b !important;
  accent-color: #1e293b !important;
  border: 0 !important;
  background: transparent !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__checkbox-mark.is-checked {
  color: #0f172a !important;
  font-size: 0.72em !important;
  font-weight: 900 !important;
}

/* Hide multi-side resize chrome on tiny checkboxes (still movable) */
body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__resize-handle--n,
body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__resize-handle--s,
body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__resize-handle--e,
body.fm-mapper-cw-match .fm-review-field--checkbox .fm-review-field__resize-handle--w {
  display: none !important;
}

/* Inner sample/inputs never draw a second box edge */
body.fm-mapper-cw-match .fm-review-field__fill-input,
body.fm-mapper-cw-match .fm-review-field__fill-input--date,
body.fm-mapper-cw-match .fm-review-field__fill-input--money,
body.fm-mapper-cw-match .fm-review-field__fill-input--strike,
body.fm-mapper-cw-match .fm-review-field__sample,
body.fm-mapper-cw-match .fm-review-field__placeholder {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .fm-review-field__fill-input--strike {
  text-decoration: line-through !important;
  text-decoration-color: #dc2626 !important;
  color: #7f1d1d !important;
}

body.fm-mapper-cw-match .fm-review-field--initials {
  max-width: 36px !important;
}

body.fm-mapper-cw-match .fm-review-field--initials .fm-review-field__body {
  justify-content: center !important;
  padding: 0 2px !important;
}

/* Page counter on form scroll */
body.fm-mapper-cw-match .fm-mapper-scroll-page {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  z-index: 20;
  pointer-events: none;
}

/* Library: emphasize unmapped + revised date */
body.fm-mapper-cw-match .fm-library__item-btn {
  text-align: left;
}

body.fm-mapper-cw-match .fm-library__item-meta--revision {
  display: block;
  font-size: 0.68rem;
  color: #6b7280;
  margin-top: 0.1rem;
}

body.fm-mapper-cw-match .fm-library__item-meta--revision.is-stale {
  color: #b45309;
  font-weight: 700;
}

body.fm-mapper-cw-match .fm-library__item-badge--unmapped {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.fm-mapper-cw-match .fm-library__item-badge--mapped {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.fm-mapper-cw-match .fm-library__sidebar-head .fm-library__title {
  font-size: 0.85rem;
}

@media (max-width: 1100px) {
  body.fm-mapper-cw-match .fm-mapper__canvas-wrap {
    grid-template-columns: minmax(0, 1fr) minmax(12.5rem, 14.5rem);
  }
}

/* --------------------------------------------------------------------------
   Clean CW-style top chrome + right field cards (form mapper)
   Condensed header: keep every control, reclaim vertical space for the PDF
   -------------------------------------------------------------------------- */

body.fm-mapper-cw-match .fm-mapper-chrome {
  flex: 0 0 auto;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

body.fm-mapper-cw-match .fm-library__editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

body.fm-mapper-cw-match .fm-library__editor-body {
  flex: 1 1 auto;
  min-height: 0;
}

/* Hide old multi-column layout strip when chrome is present */
body.fm-mapper-cw-match .fm-mapper__layout-column {
  display: none !important;
}

/* Tighter chrome rows */
body.fm-mapper-cw-match .fm-mapper-chrome .cw-map-preview-chrome__row {
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  min-height: 0;
}

body.fm-mapper-cw-match .fm-mapper-chrome__row--forms {
  padding: 0.2rem 0.45rem 0.15rem 0.5rem;
  gap: 0.2rem 0.4rem;
}

body.fm-mapper-cw-match .fm-mapper-chrome__title-block {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.2rem 0.45rem;
  min-width: 0;
  flex: 1 1 auto;
}

body.fm-mapper-cw-match .fm-mapper-chrome__title-block .fm-library__editor-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  max-width: 18rem;
  /* Keep ★ gold star visible — do not clip with overflow:hidden */
  overflow: visible;
  white-space: nowrap;
}

body.fm-mapper-cw-match .fm-mapper-chrome__title-block .fm-library__editor-title-text {
  display: inline-block;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

body.fm-mapper-cw-match .fm-mapper-chrome__title-block .fm-library__editor-meta {
  margin: 0;
  font-size: 0.65rem;
  line-height: 1.15;
  color: #6b7280;
  /* Allow full "Revised Jul 25, 2026, 7:23:06 PM" on the chrome line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

body.fm-mapper-cw-match .fm-mapper-chrome__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.18rem 0.28rem;
  margin-left: auto;
}

/* Compact toolbar / mapping controls — all buttons stay, less padding */
body.fm-mapper-cw-match .fm-mapper-chrome .cw-btn--sm,
body.fm-mapper-cw-match .fm-mapper-chrome .cw-btn.cw-btn--sm {
  padding: 0.14rem 0.42rem;
  font-size: 0.7rem;
  line-height: 1.2;
  min-height: 1.55rem;
  border-radius: 6px;
}

body.fm-mapper-cw-match .fm-mapper-chrome .cw-input--sm,
body.fm-mapper-cw-match .fm-mapper-chrome select.cw-input--sm,
body.fm-mapper-cw-match .fm-mapper-chrome input.cw-input--sm {
  min-height: 1.55rem;
  padding: 0.12rem 0.35rem;
  font-size: 0.7rem;
  line-height: 1.2;
  border-radius: 6px;
}

body.fm-mapper-cw-match .fm-mapper-chrome .cw-map-preview-dialog__toggle {
  font-size: 0.68rem;
  gap: 0.2rem;
  padding: 0.1rem 0.25rem;
  line-height: 1.15;
}

body.fm-mapper-cw-match .fm-mapper-chrome .cw-map-preview-dialog__page-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 0.15rem;
  white-space: nowrap;
}

body.fm-mapper-cw-match .fm-mapper-chrome__row--mapping {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
  padding: 0.15rem 0.45rem 0.18rem 0.5rem;
  border-top: 1px solid #f3f4f6;
  background: #f9fafb;
}

/* "Edit mapping" label is redundant when tools are visible — keep layout tight */
body.fm-mapper-cw-match .fm-mapper-chrome__row--mapping > .cw-map-preview-chrome__row-label {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  padding: 0;
  margin: 0;
  line-height: 1.1;
  max-width: 3.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.fm-mapper-cw-match .fm-mapper-chrome__row--mapping .cw-map-preview-mapping-bar {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.18rem 0.28rem;
  padding: 0;
  margin: 0;
}

body.fm-mapper-cw-match .fm-mapper-chrome__scan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.18rem;
  margin-left: 0;
}

/* Advanced (OCR / batch) — collapsed by default so place/save stays primary */
body.fm-mapper-cw-match .fm-mapper-chrome__advanced {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fafafa;
  padding: 0;
  max-width: 100%;
}

body.fm-mapper-cw-match .fm-mapper-chrome__advanced-summary {
  cursor: pointer;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #4b5563;
  list-style: none;
  line-height: 1.2;
  user-select: none;
  white-space: nowrap;
}

body.fm-mapper-cw-match .fm-mapper-chrome__advanced-summary::-webkit-details-marker {
  display: none;
}

body.fm-mapper-cw-match .fm-mapper-chrome__advanced-summary::before {
  content: "▸ ";
  color: #9ca3af;
  font-size: 0.65rem;
}

body.fm-mapper-cw-match .fm-mapper-chrome__advanced[open] .fm-mapper-chrome__advanced-summary::before {
  content: "▾ ";
}

body.fm-mapper-cw-match .fm-mapper-chrome__advanced[open] {
  flex: 1 1 100%;
  margin-left: 0;
  background: #fff;
}

body.fm-mapper-cw-match .fm-mapper-chrome__advanced-body {
  padding: 0.3rem 0.45rem 0.4rem;
  border-top: 1px solid #f3f4f6;
  margin-left: 0;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles {
  flex: 1 1 100%;
  margin: 0;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 0;
  max-height: none;
}

/* Collapsed by default — one compact summary row */
body.fm-mapper-cw-match .fm-mapper-chrome__roles-summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6b7280;
  list-style: none;
  line-height: 1.25;
  user-select: none;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles-summary::-webkit-details-marker {
  display: none;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles-summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.6rem;
  color: #94a3b8;
  transition: transform 0.12s ease;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles[open] > .fm-mapper-chrome__roles-summary::before {
  transform: rotate(90deg);
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles-summary-active {
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.65rem;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles-summary-active:empty {
  display: none;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles-summary-hint {
  font-weight: 500;
  color: #94a3b8;
  font-size: 0.62rem;
}

body.fm-mapper-cw-match .fm-mapper-chrome__roles[open] .fm-mapper-chrome__roles-summary-hint {
  display: none;
}

/* Expanded: horizontal chips, not a tall vertical stack */
body.fm-mapper-cw-match .fm-mapper-chrome__roles-body {
  padding: 0.3rem 0.45rem 0.4rem;
  border-top: 1px solid #f3f4f6;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.3rem 0.35rem;
  align-items: center;
  max-height: 5.5rem;
  overflow-y: auto;
}

body.fm-mapper-cw-match .fm-mapper__roles-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.25;
  color: #64748b;
}

body.fm-mapper-cw-match .fm-mapper__layout-roles,
body.fm-mapper-cw-match .fm-mapper__role-choices {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.28rem !important;
  width: 100%;
  max-height: none;
}

body.fm-mapper-cw-match .fm-mapper__layout-roles .fm-mapper__role-btn,
body.fm-mapper-cw-match .fm-mapper__role-choices .fm-mapper__role-btn {
  width: auto !important;
  flex: 0 0 auto !important;
  padding: 0.2rem 0.55rem !important;
  font-size: 0.68rem !important;
  border-radius: 999px !important;
  white-space: nowrap;
}

body.fm-mapper-cw-match .fm-mapper__role-editor {
  flex: 1 1 100%;
  margin: 0;
}

/* Status strip only when it has text */
body.fm-mapper-cw-match #fm-review-status {
  margin: 0;
  padding: 0.12rem 0.5rem 0.15rem;
  font-size: 0.7rem;
  line-height: 1.25;
  color: #6b7280;
  background: #fff;
  border-top: 1px solid #f3f4f6;
  min-height: 0;
}

body.fm-mapper-cw-match #fm-review-status:empty {
  display: none;
}

/* Multi-select bar under chrome: keep usable, less tall */
body.fm-mapper-cw-match .fm-group-select-bar {
  padding: 0.2rem 0.45rem;
  gap: 0.25rem 0.35rem;
  min-height: 0;
}

body.fm-mapper-cw-match .fm-group-select-bar .cw-btn--sm {
  padding: 0.12rem 0.38rem;
  font-size: 0.68rem;
  min-height: 1.5rem;
}

/* Right field cards — reuse Contract Writer field-item look */
body.fm-mapper-cw-match .cw-map-preview-page-section {
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  opacity: 0.7;
}

body.fm-mapper-cw-match .cw-map-preview-page-section.is-visible-page {
  opacity: 1;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14);
}

body.fm-mapper-cw-match .cw-map-preview-page-section__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  color: #374151;
}

body.fm-mapper-cw-match .cw-map-preview-page-section__list {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  display: grid;
  gap: 0.45rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit {
  display: grid;
  gap: 0.3rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

body.fm-mapper-cw-match .cw-map-preview-field-item__jump {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #111827;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__order {
  display: inline-block;
  min-width: 1.4rem;
  margin-right: 0.2rem;
  color: #3b82f6;
  font-variant-numeric: tabular-nums;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__meta {
  font-size: 0.68rem;
  color: #6b7280;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
  align-items: flex-end;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__ctrl {
  display: grid;
  gap: 0.1rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__ctrl .cw-input {
  min-height: 1.7rem;
  font-size: 0.72rem;
  text-transform: none;
  font-weight: 600;
  letter-spacing: normal;
  color: #111827;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align-btn,
body.fm-mapper-cw-match .cw-map-preview-field-item__align button {
  min-width: 1.5rem;
  border: 0;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.3rem;
  cursor: pointer;
  color: #6b7280;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align button:last-child {
  border-right: 0;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align button.is-active {
  background: #dbeafe;
  color: #2563eb;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__remove {
  color: #b91c1c !important;
  border-color: #fecaca !important;
  font-size: 0.7rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-empty {
  list-style: none;
  padding: 0.75rem;
  font-size: 0.78rem;
  color: #6b7280;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}

/*
 * Place tools inherit Form Library look from contract-writer.css (.cw-map-tool).
 * Keep type colors + selected blue here so form-mapping cascade never flattens them.
 */
body.fm-mapper-cw-match .cw-map-tool,
body.fm-mapper-cw-match .fm-place-tool {
  min-width: 2.65rem;
  min-height: 2.55rem;
  border-radius: 8px;
  font-weight: 700;
}

body.fm-mapper-cw-match .cw-map-tool.is-text,
body.fm-mapper-cw-match .fm-place-tool.is-text {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1e3a5f !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-money,
body.fm-mapper-cw-match .fm-place-tool.is-money {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #14532d !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-strikethrough,
body.fm-mapper-cw-match .fm-place-tool.is-strikethrough {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #7f1d1d !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-checkbox,
body.fm-mapper-cw-match .fm-place-tool.is-checkbox {
  background: #ffedd5 !important;
  border-color: #fdba74 !important;
  color: #7c2d12 !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-signature,
body.fm-mapper-cw-match .fm-place-tool.is-signature {
  background: #ede9fe !important;
  border-color: #d8b4fe !important;
  color: #581c87 !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-initials,
body.fm-mapper-cw-match .fm-place-tool.is-initials {
  background: #e0e7ff !important;
  border-color: #c4b5fd !important;
  color: #4c1d95 !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-datetime,
body.fm-mapper-cw-match .fm-place-tool.is-datetime {
  background: #d1fae5 !important;
  border-color: #6ee7b7 !important;
  color: #064e3b !important;
  box-shadow: none !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-selected,
body.fm-mapper-cw-match .cw-map-tool.is-active,
body.fm-mapper-cw-match .cw-map-tool[aria-pressed="true"],
body.fm-mapper-cw-match .fm-place-tool.is-selected,
body.fm-mapper-cw-match .fm-place-tool.is-active,
body.fm-mapper-cw-match .fm-place-tool[aria-pressed="true"],
body.fm-mapper-cw-match .cw-map-tool.fm-review-esign-tool.is-selected,
body.fm-mapper-cw-match .cw-map-tool.fm-review-esign-tool.is-active,
body.fm-mapper-cw-match .cw-map-tool[data-field-type].is-selected,
body.fm-mapper-cw-match .cw-map-tool[data-field-type].is-active {
  background: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: inset 3px 0 0 #2563eb, 0 0 0 2px rgba(37, 99, 235, 0.22) !important;
}

body.fm-mapper-cw-match .cw-map-tool.is-selected .cw-map-tool__glyph,
body.fm-mapper-cw-match .cw-map-tool.is-active .cw-map-tool__glyph,
body.fm-mapper-cw-match .cw-map-tool.is-selected .cw-map-tool__name,
body.fm-mapper-cw-match .cw-map-tool.is-active .cw-map-tool__name,
body.fm-mapper-cw-match .cw-map-tool.is-selected .fm-mapper__layout-tool-glyph,
body.fm-mapper-cw-match .cw-map-tool.is-active .fm-mapper__layout-tool-glyph,
body.fm-mapper-cw-match .cw-map-tool.is-selected .fm-mapper__layout-tool-name,
body.fm-mapper-cw-match .cw-map-tool.is-active .fm-mapper__layout-tool-name,
body.fm-mapper-cw-match .fm-place-tool.is-selected .fm-place-tool__glyph,
body.fm-mapper-cw-match .fm-place-tool.is-active .fm-place-tool__glyph,
body.fm-mapper-cw-match .fm-place-tool.is-selected .fm-place-tool__name,
body.fm-mapper-cw-match .fm-place-tool.is-active .fm-place-tool__name {
  color: #fff !important;
}

body.fm-mapper-cw-match #fm-fill-mode-esign,
body.fm-mapper-cw-match #fm-fill-mode-now {
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  color: #6b7280 !important;
  font-weight: 700;
}

body.fm-mapper-cw-match #fm-fill-mode-esign.is-active,
body.fm-mapper-cw-match #fm-fill-mode-esign.is-selected,
body.fm-mapper-cw-match #fm-fill-mode-now.is-active,
body.fm-mapper-cw-match #fm-fill-mode-now.is-selected {
  background: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

body.fm-mapper-cw-match .fm-mapper__role-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

body.fm-mapper-cw-match .fm-mapper__role-btn.is-active {
  background: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

/* Form Mapper right list = Contract Writer review sidebar (exact structure) */
body.fm-mapper-cw-match .fm-review-fields-column.cw-map-preview-dialog__sidebar {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  width: auto !important;
  min-width: 15rem;
  max-width: 18rem;
  border-left: 1px solid #d1d5db;
  padding: 0.55rem 0.55rem 0.55rem 0.65rem;
  overflow: hidden;
  background: #f9fafb;
  box-shadow: inset 1px 0 0 rgba(15, 23, 42, 0.04);
}

body.fm-mapper-cw-match .fm-review-fields-column .cw-map-preview-dialog__field-count {
  flex: 0 0 auto;
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #1e3a5f;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
}

body.fm-mapper-cw-match .fm-review-fields-column .cw-map-preview-dialog__sidebar-scroll {
  flex: 1 1 0%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0.1rem;
}

body.fm-mapper-cw-match .fm-review-fields-column .cw-map-preview-dialog__field-list {
  list-style: none;
  margin: 0;
  padding: 0 0 1.25rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

body.fm-mapper-cw-match .cw-map-preview-page-section {
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  opacity: 0.62;
}

body.fm-mapper-cw-match .cw-map-preview-page-section.is-visible-page {
  opacity: 1;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

body.fm-mapper-cw-match .cw-map-preview-page-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  user-select: none;
}

body.fm-mapper-cw-match .cw-map-preview-page-section.is-visible-page .cw-map-preview-page-section__head {
  background: #dbeafe;
  border-bottom-color: #bfdbfe;
}

body.fm-mapper-cw-match .cw-map-preview-page-section__title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.fm-mapper-cw-match .cw-map-preview-page-section__meta {
  font-size: 0.68rem;
  color: #6b7280;
  font-weight: 600;
}

body.fm-mapper-cw-match .cw-map-preview-page-section__list {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  display: grid;
  gap: 0.35rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 0.45rem 0.5rem;
  text-align: left;
  display: grid;
  gap: 0.35rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  opacity: 1 !important;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-other-page {
  opacity: 0.55;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-on-visible-page {
  opacity: 1;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-empty.is-on-visible-page {
  border-color: #f59e0b;
  background: #fffbeb;
}

body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-filled.is-on-visible-page {
  border-color: #86efac;
  background: #f0fdf4;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__jump {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #111827;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.15rem;
  margin-right: 0.25rem;
  padding: 0 0.28rem;
  border-radius: 4px;
  background: #e0e7ff;
  color: #1e3a5f;
  font-size: 0.65rem;
  font-weight: 800;
  vertical-align: middle;
}

body.fm-mapper-cw-match .cw-map-preview-field-item.is-active .cw-map-preview-field-item__order,
body.fm-mapper-cw-match .cw-map-preview-field-item--edit.is-active .cw-map-preview-field-item__order {
  background: #2563eb;
  color: #fff;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__meta {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.68rem;
  color: #6b7280;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__edit {
  width: 100%;
  min-height: 1.85rem;
  font-size: 0.78rem;
}

/* Field name — edit to match mapped/catalog form field names */
body.fm-mapper-cw-match .cw-map-preview-field-item__name {
  display: grid;
  gap: 0.1rem;
  margin: 0.1rem 0 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__name-input {
  width: 100%;
  min-height: 1.85rem;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: #111827 !important;
  border: 1px solid #93c5fd !important;
  background: #eff6ff !important;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__name-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  border-color: #3b82f6 !important;
  background: #fff !important;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__name-input.is-system-name {
  /* Neutral slate — no green highlight on form fields */
  border-color: #94a3b8 !important;
  background: #f1f5f9 !important;
  color: #334155 !important;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__ctrl {
  display: grid;
  gap: 0.1rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__ctrl .cw-input {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: #111827;
  min-height: 1.7rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__ctrl--wide {
  grid-column: 1 / -1;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align-btn {
  min-width: 1.55rem;
  height: 1.7rem;
  padding: 0 0.35rem;
  border: 0;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align-btn:last-child {
  border-right: 0;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__align-btn.is-active {
  background: #3b82f6;
  color: #fff;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
}

body.fm-mapper-cw-match .cw-map-preview-field-item__remove {
  justify-self: start;
  margin-top: 0.1rem;
  color: #b91c1c !important;
  border-color: #fecaca !important;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
}

body.fm-mapper-cw-match .cw-map-preview-field-empty {
  font-size: 0.8rem;
  color: #6b7280;
  list-style: none;
  padding: 0.65rem 0.5rem;
}

/* Dedicated place-tool icons — type-colored fills + solid blue when selected (compact) */
/* Place mode: crosshair on PDF + ready chip */
body.fm-is-placing .fm-mapper__canvas-wrap.is-placing,
body.fm-is-placing .fm-mapper__canvas-wrap.is-placing .fm-review-document,
body.fm-is-placing .fm-mapper__canvas-wrap.is-placing .fm-review-page-shell,
body.fm-is-placing .fm-mapper__canvas-wrap.is-placing .fm-review-page-stage {
  cursor: crosshair !important;
}

.fm-place-ready {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: min(28rem, 100%);
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.fm-place-ready[hidden] {
  display: none !important;
}

.fm-place-ready__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  flex: 0 0 auto;
  animation: fm-place-pulse 1.2s ease-in-out infinite;
}

@keyframes fm-place-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.9);
  }
}

.fm-place-ready__text {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.fm-place-ready__cancel {
  border: 0;
  background: transparent;
  color: #1d4ed8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  flex: 0 0 auto;
}

.fm-place-ready__cancel:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #1e3a8a;
}

#fm-review-add-field-btn.is-armed {
  background: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #fff !important;
}

/* Preferred type (not armed yet) — subtle ring, not full blue select */
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool.is-tool-pref:not(.is-selected) {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35) !important;
}

body.fm-mapper-cw-match .fm-mapper-place-tools,
body.fm-mapper-cw-match #fm-mapper-place-tools {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.12rem;
}

body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool,
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 2.05rem;
  min-height: 2.05rem;
  margin: 0;
  padding: 0.14rem 0.22rem 0.1rem;
  border: 1px solid #d1d5db !important;
  border-radius: 6px;
  background: #f3f4f6 !important;
  color: #111827 !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-text { background: #bfdbfe !important; color: #1e3a5f !important; border-color: #93c5fd !important; }
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-money { background: #bbf7d0 !important; color: #14532d !important; border-color: #86efac !important; }
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-strikethrough { background: #fecaca !important; color: #7f1d1d !important; border-color: #fca5a5 !important; }
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-checkbox { background: #fed7aa !important; color: #7c2d12 !important; border-color: #fdba74 !important; }
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-signature { background: #e9d5ff !important; color: #581c87 !important; border-color: #d8b4fe !important; }
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-initials { background: #ddd6fe !important; color: #4c1d95 !important; border-color: #c4b5fd !important; }
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-datetime { background: #a7f3d0 !important; color: #064e3b !important; border-color: #6ee7b7 !important; }

body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-selected,
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool.is-active,
body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool[aria-pressed="true"],
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool.is-selected,
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool.is-active,
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool[aria-pressed="true"] {
  background: #3b82f6 !important;
  background-color: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35) !important;
}

body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool__glyph,
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool__glyph {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.05;
  color: inherit !important;
  opacity: 1 !important;
}

body.fm-mapper-cw-match #fm-mapper-place-tools .cw-map-tool__name,
body.fm-mapper-cw-match #fm-mapper-place-tools .fm-place-tool__name {
  display: block;
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: inherit !important;
  opacity: 1 !important;
}

/* Mapping bar meta / actions denser */
body.fm-mapper-cw-match .fm-mapper-chrome .cw-map-preview-mapping-bar__meta,
body.fm-mapper-cw-match .fm-mapper-chrome .cw-map-preview-mapping-bar__actions {
  gap: 0.18rem;
}

body.fm-mapper-cw-match .fm-mapper-chrome .cw-map-preview-mapping-bar__label-input {
  max-width: 7.5rem;
  min-width: 5rem;
}

/* Slightly less top padding on the PDF scroller so the form sits higher */
body.fm-mapper-cw-match .fm-review-canvas-scroll {
  padding-top: 0.35rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Gold Standard Mapping toolbar button (right side of Form Mapper chrome) */
/* Save library PDF without boxes — Contract Writer can still package it as-is */
.fm-btn-no-mapping,
button.fm-btn-no-mapping {
  border-color: #6366f1 !important;
  color: #312e81 !important;
  background: #e0e7ff !important;
  font-weight: 700 !important;
}
.fm-btn-no-mapping:hover:not(:disabled),
button.fm-btn-no-mapping:hover:not(:disabled) {
  background: #c7d2fe !important;
  border-color: #4f46e5 !important;
}
.fm-btn-no-mapping--active,
button.fm-btn-no-mapping--active {
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.25);
}

.fm-btn-gold-standard,
button.fm-btn-gold-standard {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 0.15rem;
  padding: 0.2rem 0.65rem !important;
  border: 1px solid #b45309 !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 55%, #d97706 100%) !important;
  color: #422006 !important;
  font-weight: 800 !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(120, 53, 15, 0.25);
  white-space: nowrap;
}
.fm-btn-gold-standard:hover:not(:disabled),
button.fm-btn-gold-standard:hover:not(:disabled) {
  background: linear-gradient(180deg, #fef3c7 0%, #fbbf24 50%, #f59e0b 100%) !important;
  border-color: #92400e !important;
  color: #291406 !important;
}
.fm-btn-gold-standard:disabled,
button.fm-btn-gold-standard:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
.fm-btn-gold-standard.is-running,
button.fm-btn-gold-standard.is-running {
  animation: fm-gold-pulse 1.1s ease-in-out infinite;
}
@keyframes fm-gold-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.12); }
}

/* Gold Standard Mapping — Form Mapper library list + Working on card */
.fm-library__item-title-wrap {
  display: block;
  min-width: 0;
}
/* Inline star after title — always visible, never clipped by absolute layout */
.fm-library__item-gold-star {
  display: inline;
  margin-left: 0.35rem;
  font-size: 1.15rem;
  line-height: 1;
  color: #e6a800 !important;
  text-shadow: 0 0 2px rgba(120, 80, 0, 0.45);
  vertical-align: baseline;
}
.fm-library__section-head--working .fm-library__working-gold-star {
  color: #e6a800;
  font-size: 1rem;
  margin-left: 0.25rem;
}
.fm-library__section-head--working .fm-library__working-rev {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #1e3a5f;
  line-height: 1.25;
}
.fm-library__item-revision-date {
  display: block;
  font-weight: 700;
  color: #334155;
}
.fm-library__item-revision-time {
  display: block;
  margin-top: 0.05rem;
  font-weight: 800;
  font-size: 0.72rem;
  color: #0f172a;
  letter-spacing: 0.01em;
}
/* Working on / active form — star + revision are the source of truth for gold status */
.fm-library__item.is-active .fm-library__item-gold-star,
.fm-library__item-btn.is-active .fm-library__item-gold-star {
  font-size: 1.3rem;
  color: #f5b800 !important;
  text-shadow: 0 0 3px rgba(180, 120, 0, 0.55);
}
.fm-library__item.is-active .fm-library__item-meta--revision,
.fm-library__item-btn.is-active .fm-library__item-meta--revision {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.25;
}
.fm-library__item--gold .fm-library__item-btn {
  border-color: rgba(212, 160, 23, 0.35);
  background: linear-gradient(180deg, #fffef8 0%, #fff 75%);
}
.fm-library__item--gold .fm-library__item-btn.is-active,
.fm-library__item.is-active.fm-library__item--gold .fm-library__item-btn {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%) !important;
  border-color: #3b82f6 !important;
}
.fm-library__item-badge--gold,
.fm-review-form-badge--gold {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #8a6d0b;
  background: rgba(212, 160, 23, 0.2);
  border: 1px solid rgba(212, 160, 23, 0.45);
}
/* Editor chrome title (right of Working on list) also shows ★ + revision time */
.fm-library__editor-title,
.fm-mapper-chrome__title-block .fm-library__editor-title {
  display: block;
  overflow: visible;
}
.fm-library__editor-title-text {
  display: inline;
}
.fm-library__editor-gold-star {
  display: inline;
  margin-left: 0.35rem;
  font-size: 1.15rem;
  color: #e6a800 !important;
}

/* One plate: mapped grey box is fillable. No inner framed input. */
.fm-review-field__body {
  position: relative;
}
.fm-review-field__fill-input,
.fm-review-field__fill-select,
.fm-review-field__date-chip,
textarea.fm-review-field__fill-input {
  box-sizing: border-box;
}
body.fm-mapper-cw-match .fm-review-field__body {
  position: relative !important;
}
body.fm-mapper-cw-match .fm-review-field__fill-input,
body.fm-mapper-cw-match .fm-review-field__fill-select,
body.fm-mapper-cw-match .fm-review-field__date-chip,
body.fm-mapper-cw-match textarea.fm-review-field__fill-input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  flex: none !important;
  margin: 0 !important;
  padding: 1px 4px !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  resize: none !important;
}
