/* === MODAL FIRMA === */
.fma-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 9500;
  display: flex;
  align-items: stretch;
  justify-content: center;
  transition: background-color .2s ease;
  pointer-events: none;
}
.fma-overlay.fma-open {
  background: rgba(0, 0, 0, .55);
  pointer-events: auto;
}
.fma-overlay.fma-closing {
  background: rgba(0, 0, 0, 0);
}

.fma-modal {
  width: 100%;
  max-width: 600px;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.2,.9,.3,1);
  overflow: hidden;
  margin: auto 0 0;
  max-height: 95vh;
  border-radius: 18px 18px 0 0;
}
.fma-overlay.fma-open .fma-modal {
  transform: translateY(0);
}
.fma-overlay.fma-closing .fma-modal {
  transform: translateY(100%);
}

@media (min-width: 700px) {
  .fma-overlay { align-items: center; }
  .fma-modal { margin: auto; border-radius: 14px; max-height: 90vh; }
}

.fma-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.fma-title {
  font-size: 16px;
  font-weight: 800;
  color: #263169;
}
.fma-close {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
}

.fma-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
}

.fma-field { margin-bottom: 16px; }
.fma-lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.fma-lbl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.fma-lbl-row .fma-lbl { margin: 0; }
.fma-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}
.fma-clear {
  background: none;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.fma-field input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: 15px;
  background: #f8fafc;
  font-family: inherit;
}
.fma-field input[type="text"]:focus {
  outline: none;
  border-color: #0284c7;
  background: #fff;
}

.fma-canvas {
  width: 100%;
  height: 130px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 9px;
  background: #fff;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.fma-status {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 10px;
  display: none;
}
.fma-status.err   { background: #fee2e2; color: #991b1b; display: block; }
.fma-status.info  { background: #e0f2fe; color: #075985; display: block; }
.fma-status.ok    { background: #dcfce7; color: #166534; display: block; }

.fma-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.fma-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.fma-btn:disabled { opacity: .55; cursor: not-allowed; }
.fma-btn-sec { background: #f1f5f9; color: #475569; }
.fma-btn-pri { background: #263169; color: #fff; }
