:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #d8deea;
  --text: #182230;
  --muted: #667085;
  --accent: #1d4ed8;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans Hebrew", "Heebo", sans-serif;
}

body {
  min-height: 100vh;
}

button, input, select, textarea {
  font: inherit;
}

.workspace {
  padding: 12px;
}

.workspace-clean {
  padding-top: 92px;
}

.floating-toolbar {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 9999;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
}

.floating-toolbar > * {
  pointer-events: auto;
}

.btn {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  background: rgba(255,255,255,0.96);
  color: #111827;
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.75;
  cursor: default;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-secondary {
  background: #0f766e;
  color: #fff;
}

.btn-success {
  background: #15803d;
  color: #fff;
}

.floating-link-panel {
  position: fixed;
  top: 58px;
  left: 10px;
  z-index: 9998;
  width: min(560px, calc(100vw - 20px));
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
}

.link-panel-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

#generatedLinkInput {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  direction: ltr;
  text-align: left;
}

.status-toast {
  margin-top: 8px;
  min-height: 18px;
  font-size: 14px;
  font-weight: 700;
  color: #0f766e;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.status-toast.show {
  opacity: 1;
}

.status-toast.error {
  color: #b42318;
}

.pdf-container {
  display: grid;
  gap: 18px;
}

.pdf-page-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--shadow);
}

.pdf-page-stage {
  position: relative;
  width: fit-content;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.pdf-image {
  display: block;
  max-width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.pdf-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: auto;
}

.overlay-field {
  position: absolute;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  z-index: 20;
  pointer-events: auto;
  box-sizing: border-box;
}

.overlay-field input[type="text"],
.overlay-field input[type="email"],
.overlay-field input[type="number"],
.overlay-field input[type="date"],
.overlay-field select,
.overlay-field textarea {
  width: 100%;
  min-height: 100%;
  border: 1px solid rgba(29, 78, 216, 0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 4px 8px;
  font-size: 16px;
  line-height: 1.1;
  overflow: hidden;
}

.overlay-field input[readonly] {
  background: rgba(248,250,252,0.96);
  color: #334155;
  font-weight: 600;
}

.overlay-field.checkbox-field {
  justify-content: center;
  align-items: center;
  display: flex;
}

.overlay-field.checkbox-field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
}

.overlay-field.signature-field {
  border: 1px dashed rgba(29, 78, 216, 0.4);
  border-radius: 10px;
  background: rgba(29, 78, 216, 0.04);
  overflow: hidden;
  z-index: 50;
}

.overlay-field.upload-field {
  border: 1px dashed rgba(2, 122, 72, 0.35);
  border-radius: 10px;
  background: rgba(2, 122, 72, 0.05);
  overflow: hidden;
  z-index: 20;
}

.overlay-field.upload-overlap-under-signature {
  transform: translateY(21px);
}

.signature-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: rgba(255,255,255,0.10);
  touch-action: none;
  cursor: crosshair;
  z-index: 2;
}

.signature-clear-btn {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 4;
}

.overlay-btn-row {
  position: absolute;
  left: 2px;
  display: flex;
  gap: 4px;
  z-index: 4;
}

.overlay-btn-row.bottom-buttons {
  bottom: 2px;
  top: auto;
}

.overlay-mini-btn,
.signature-clear-btn,
.upload-btn,
.upload-clear-btn {
  border: 1px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.96);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.1;
  width: auto;
  min-width: 0;
  cursor: pointer;
}

.upload-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 4px;
  padding-bottom: 28px;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  flex-direction: column;
  gap: 4px;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.real-file-input {
  display: none;
}

.attachment-item {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 6px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}

.other-text-inline {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(29, 78, 216, 0.15);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  line-height: 1.2;
  color: #111827;
  z-index: 60;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  direction: rtl;
}

.checkbox-other-inline {
  top: calc(100% + 6px);
}

@media (max-width: 900px) {
  .workspace-clean {
    padding-top: 116px;
  }

  .floating-toolbar {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .floating-link-panel {
    top: 98px;
    left: 8px;
    width: calc(100vw - 16px);
  }
}










.inline-other-wrap {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 190px;
  max-width: 220px;
  z-index: 60;
}

.inline-other-wrap.always-visible {
  display: block;
}

.inline-other-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.inline-other-input.other-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible;
}

.inline-other-wrap {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 190px;
  max-width: 220px;
  z-index: 60;
}

.inline-other-wrap.always-visible {
  display: block;
}

.inline-other-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.inline-other-input.other-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}

/* 86C OTHER FIX START */
.checkbox-other-fixed {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: 210px;
  max-width: 240px;
  z-index: 80;
}

.checkbox-other-fixed-input {
  width: 100%;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  color: #111827;
  text-align: right;
  direction: rtl;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.2;
}

.checkbox-other-fixed-input-disabled {
  background: rgba(248,250,252,0.95);
  color: #64748b;
}

.overlay-field.checkbox-field {
  overflow: visible !important;
}
/* 86C OTHER FIX END */


.checkbox-other-inline{
  margin-right:8px;
  width:160px;
  border:1px solid #ccc;
  border-radius:6px;
  padding:3px 6px;
  font-size:14px;
}

.overlay-field.checkbox-field{
  display:flex;
  align-items:center;
  gap:6px;
}



.status-toast.sticky {
  opacity: 1 !important;
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
}

/* FIX 18A OVERLAP START */
.overlay-field[data-field-id="fld-18"] {
  z-index: 20 !important;
}

.overlay-field[data-field-id="fld-18a"] {
  transform: translateY(34px) !important;
  z-index: 60 !important;
}
/* FIX 18A OVERLAP END */

.final-trace-box{
  position:fixed;
  left:12px;
  bottom:12px;
  z-index:999999;
  width:min(520px, calc(100vw - 24px));
  max-height:40vh;
  overflow:auto;
  background:rgba(17,24,39,0.96);
  color:#fff;
  border-radius:12px;
  padding:10px 12px;
  font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  white-space:pre-wrap;
  word-break:break-word;
  box-shadow:0 10px 30px rgba(0,0,0,0.28);
}


.overlay-field[data-field-id="fld-137"]{
  outline: 2px solid #d00000 !important;
  background: rgba(255,248,168,0.88) !important;
  z-index: 99999 !important;
}

.overlay-field[data-field-id="fld-137"] select{
  background: #fff8a6 !important;
  border: 1px solid #d00000 !important;
  color: #111 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}
